处理函数可以去除function进行书写
add(n) { // 在 methods 处理函数中,this 就是 new 出来的 vm 实例对象 // console.log(vm === this) console.log(vm) // vm.count += 1 this.count += n }, sube() { // console.log('触发了 sube 处理函数') this.count -= 1 }
处理函数可以去除function进行书写
add(n) { // 在 methods 处理函数中,this 就是 new 出来的 vm 实例对象 // console.log(vm === this) console.log(vm) // vm.count += 1 this.count += n }, sube() { // console.log('触发了 sube 处理函数') this.count -= 1 }