代码如下
import 'babel-polyfill'
import Vue from 'vue'
import VueRouter from 'vue-router'
import store from './vuex/store'
import http from 'vue-resource'
import App from './App.vue'
import Vuex from 'vuex'
Vue.use(http)
Vue.use(VueRouter)
Vue.use(Vuex)
Vue.http.options.root = '/root'
Vue.http.options.emulateJSON = true
Vue.config.debug = true
var router = new VueRouter()
require('./routerConfig')(router)
new Vue({
store: store,
components: { App }
})
router.start(App, '#app')
然后store文件
import Vuex from 'vuex'
import frontPage from './modules/frontPage'
import viewsPage from './modules/viewsPage'
import commentPage from './modules/commentPage'
import Vue from 'vue'
Vue.use(Vuex)
export default new Vuex.Store({
modules: {
frontPage,
viewsPage,
commentPage
}
})
然而控制台的输出却是这样的!
[vuex] store not injected. make sure to provide the store option in your root component.
不知道怎么解决,求助求助!
幕布斯6054654
拉丁的传说