状态可以拿到,鼓捣了好久。不懂定义在模块里面的mutations、getters、actions要怎么调用?constmA={state:{a:1,b:1,},//模块的局部mutationsmutations:{add:state=>{state.a++},},getters:{double:state=>{returnstate.a*2}}}constmB={state:{a:2,b:2,},//模块的局部mutationsmutations:{addB:state=>{state.a++},},//模块的局部actionsactions:{asyncAdd:({commit,rootState,state})=>{setTimeout(()=>{commit('add');},1000);}}}conststore=newVuex.Store({modules:{a:mA,b:mB,}});console.log(store.state.a);
慕田峪9158850
有只小跳蛙
相关分类