Vue實例常用屬性
1.數據
data:Vue 實例的數據對象
components:Vue實例配置局部注冊組件
1.類方法
computed:計算屬性
watch:偵聽屬性
filters:過濾器
methods:Vue實例方法
render:渲染函數,創建虛擬DOM
1.生命周期
created:在實例創建完成后被立即調用,完成初始化操作
mounted:el掛載到Vue實例上了,開始業務邏輯操作
beforeDestroy:實例銷毀之前調用
實例
var vm = new Vue({el: '#app',data: {cc: ''},mounted:function(){this.ajax();},methods: {initData: function(res) {this.cc = '123';}},watch:{ cc:function(c){if(c='321'){console.log("vm.cc改變了");}}},
});