示例:修改state中info对象的name值
state: { info: {id: 1003, name: "kobe" } }
actions: {//异步的操作写在actions里面 aUpdateInfo(context){ setTimeout(()=>{ context.commit('updateInfo') },1000) } }
mutations: {//同步方法写在mutations中 updateInfo(state){ state.info.name='XX' } }
标签:info,name,updateInfo,mutations,actions,state,vuex From: https://www.cnblogs.com/ixtao/p/16929400.html