index.js
modules: {
enterpriseInformation
}
enterprise-information.js
const enterpriseInformation = {
state: {
userInfo: {},
},
mutations: {
HAND_USER(state,user) {
state.userInfo = user;
}
},
actions: {
handUserAction ({commit}, user) {
commit('HAND_USER',user);
}
}
}
export default enterpriseInformation
调用enterpriseInformation的handUserAction action方法
this.$store.dispatch('handUserAction',你传递的数据);
获取enterpriseInformation中的userInfo
...mapState({
userInfo: state => state.enterpriseInformation.userInfo
})