Vuex——命名空间导致错误[unknown action type:XXX]解决方案
问题描述[vuex] unknown action type: xxx官方文档https://vuex.vuejs.org/zh/guide/actions.htmlhttps://vuex.vuejs.org/zh/guide/modules.html#命名空间问题分析暂无。解决方案1.把命名空间 代码注释掉export default {// na...
·
问题描述
[vuex] unknown action type: xxx
官方文档
https://vuex.vuejs.org/zh/guide/actions.html
https://vuex.vuejs.org/zh/guide/modules.html#命名空间
问题分析
暂无。
解决方案
1.把命名空间 代码注释掉
export default {
// namespaced: true,
state,
getters,
actions,
mutations
}
如果项目数据多,不建议 注释掉命名空间,不然方法名字重复了会造成混乱
如果有命名空间,只要文件名字不一样,方法名字一样也可以;
2.this.$store.commit(‘app/changeNum’) 或者使用mapActions
...mapActions({
add: "app/changeNumAsync",
sub: "app/subtract"
})
参考文章
https://blog.csdn.net/weixin_44369568/article/details/101625709
更多推荐
已为社区贡献22条内容
所有评论(0)