代码import Vue from 'vue'import App from './App'import router from './router'import common from './assets/js/common'import Vuex from 'vuex'import ElementUi from 'element-ui'import 'element-ui/lib/theme-default/index.css'import MintUi from 'mint-ui'import 'mint-ui/lib/style.css'Vue.config.productionTip = falseVue.use(common)Vue.use(ElementUi)Vue.use(MintUi)Vue.use(Vuex)const vuex_store = new Vuex.store({state:{
msg:""},
mutations:{
showUserName(state){
alert(state.msg);
}
}})new Vue({el: '#app',store:vuex_store,router,template: '<App/>',components: { App }})报错如下Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_4_vuex__.a.store is not a function
2 回答
慕婉清6462132
TA贡献1804条经验 获得超2个赞
new Vuex.Store是这样的
const vuex_store = new Vuex.Store({
state:{
msg:""
},
mutations:{
showUserName(state){ alert(state.msg); }
}
})
添加回答
举报
0/150
提交
取消