扫码关注官方订阅号
为什么在触发action后,count实际的值和 state中的不一样
action
count
state
mutations.js
export default{ increment (state){ state.count++ } }
actions.js
export default{ incrementsync(context){ context.commit('increment') } }
然后在app.vue中有个按钮触发this.$store.dispatch('incrementsync')
this.$store.dispatch('incrementsync')
Following the voice in heart.
vuex2.0?你的组件是怎么使用的,以及state是store中储存的state还是页面里的state,假如你是用getter方法获取的state,那么你正确的dispatch了之后应该是能触发改变的
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
vuex2.0?你的组件是怎么使用的,以及state是store中储存的state还是页面里的state,假如你是用getter方法获取的state,那么你正确的dispatch了之后应该是能触发改变的