1、使用vuex 在组件里使用this.$store.commit()提示不是function在enter.vue中 created () {
this.$store.commit('changeIndexConf', {
isTab: true,
isBack: false,
title: ''
});
}3.store.jsimport Vue from 'vue';import Vuex from 'vuex';
Vue.use(Vuex)const store = new Vuex.Store({
state: {
comm: {
loading: false,
login: {
memberId: ''
},
indexConf: {
isTab: false
}
}
},
mutations: {
changeIndexConf: (state, data) => {
Object.assign(state.comm.indexConf, data);
}
}
});
export default store4、提示enterpiseList.vue?c518:15 Uncaught TypeError: this.$store.commit is not a function
添加回答
举报
0/150
提交
取消