// Vue实例化
let vm = new Vue({
el: '#app',
data() {
return {
aa: 1,
bb: 2,
cc: 3,
}
},
// render(h) {
// return h('div',{id:'a'},'hello')
// },
template: `<div id="a">hello 这是我自己写的Vue{{computedName}}{{cc}}</div>`,
computed: {
computedName() {
return this.aa + this.bb
},
},
})
// 当我们每一次改变数据的时候 渲染watcher都会执行一次 这个是影响性能的
setTimeout(() => {
vm.cc = 4
}, 2000)
console.log(vm)
大约 3 分钟