2020
10-08
10-08
解决Vue 给mapState中定义的属性赋值报错的问题
1.实践环境Vue2.9.62.问题描述<script>import{mapState}from'vuex';exportdefault{name:"displayCount",computed:{...mapState({...略count:state=>state.a.count})},methods:{increaseCount(){this.count=this.count+1}}};</script><style></style>如上,我们希望在执行increaseCount函数时,给mapstate函数中映射定义的this.count赋值,给该值增加1,结果,提示[Vuewarn]:Compute...
继续阅读 >