data在vue框架中位置不一樣,用法也不一樣。簡單地說,在實例中data是一個對象,在組件中data就得是函數返回對象。
new Vue( { data : { title : 'abc' } } );
Vue.component( 'component-name', Vue.extend( { data : function() { return { title : 'abc' }; } } ) );
data在vue框架中位置不一樣,用法也不一樣。簡單地說,在實例中data是一個對象,在組件中data就得是函數返回對象。
new Vue( { data : { title : 'abc' } } );
Vue.component( 'component-name', Vue.extend( { data : function() { return { title : 'abc' }; } } ) );
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。