watch: {
'$store.state.fold': {
handler() {
this.wheel()
},
},
},
上面是正确写法,可以调用成功
这个是错误写法
watch: {
'$store.state.fold': {
handler:()=> {
this.wheel()
},
},
},
watch: {
'$store.state.fold': {
handler:function() {
this.wheel()
},
},
},
本文对比了Vue中正确与错误的watch语法,重点讲解了在Vuex中使用watch时如何正确设置handler。通过实例展示了如何调用store的方法。
986

被折叠的 条评论
为什么被折叠?



