Vuex——命名空间导致错误[unknown action type:XXX]解决方案
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                Vuex——命名空间导致错误[unknown action type:XXX]解决方案
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.                        
                                問題描述
[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 }如果項目數(shù)據(jù)多,不建議 注釋掉命名空間,不然方法名字重復(fù)了會造成混亂
如果有命名空間,只要文件名字不一樣,方法名字一樣也可以;?
2.this.$store.commit(‘a(chǎn)pp/changeNum’) 或者使用mapActions
?...mapActions({add: "app/changeNumAsync",sub: "app/subtract"})?
參考文章
https://blog.csdn.net/weixin_44369568/article/details/101625709
https://blog.csdn.net/wo_dxj/article/details/87882700
總結(jié)
以上是生活随笔為你收集整理的Vuex——命名空间导致错误[unknown action type:XXX]解决方案的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: RabbitMQ——自动退出的解决方案
- 下一篇: WebSocket——[Error du
