1、使用vuex 在组件里使用this.$store.commit()提示不是function
在enter.vue中
created () { this.$store.commit('changeIndexConf', { isTab: true, isBack: false, title: '' }); }
3.store.js
import 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 store
4、提示
enterpiseList.vue?c518:15 Uncaught TypeError: this.$store.commit is not a function
陪伴而非守候
元芳怎么了