javascript - vuex初始的时候报错

查看:134
本文介绍了javascript - 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

解决方案

new Vuex.Store()好像是,也就是store的S要大写!

这篇关于javascript - vuex初始的时候报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆