ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[toc] modules即是store里的store 一般是按照不同组件模块而分的子store 并且可以无限递归先去 ``` ,modules:{ a:{ //默认为false // namespaced:true, state:{ text:'a' } ,mutations:{ updateText(state){ //这个state是 a模块单独的state 而不是全部 } } ,getters:{ textPlus(state,getters,rootState){ return state.text + rootState.count; } } ,actions:{ // add(ctx){ // //ctx是值属于当前模块的子store对象 // } add({state,commit,rootState}){ //提交到的是本模块的updateText //{root:true}能提交到全局的updateText // commit('updateText',rootState.count/*,{root:true}*/); commit('updateCount',{num:56789},{root:true}); } } } ,b:{ state:{ text:'b' } } } }); ```