vuex初始的时候报错

代码
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 = false
Vue.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


慕田峪4524236
浏览 1312回答 2
2回答

慕婉清6462132

new Vuex.Store是这样的const vuex_store = new Vuex.Store({state:{msg:""},mutations:{showUserName(state){ &nbsp;&nbsp;&nbsp;&nbsp;alert(state.msg); }}})

冉冉说

new Vuex.Store()好像是,也就是store的S要大写!
打开App,查看更多内容
随时随地看视频慕课网APP