2017-10-05 112 views
1

我在./store.js定義我的商店:Vue-socket.io vuex商店集成

import Vue from 'vue' 
import Vuex from 'vuex' 

Vue.use(Vuex) 

export default new Vuex.Store({ 
    ... 
}); 

,並希望建立vue-socket.io在我main.js:

import { MyVuexStore } from './store.js' 

Vue.use(VueSocketio, 'http://localhost:5000', MyVuexStore); 

然而,由於店裏有沒有名字,我不能導入它並把它傳遞給VueSocketio:

62:46-57「出口‘MyVuexStore’不是在」 ./store.js'發現

回答

1

我想如果你使用'導出默認',你不用curley's導入。 嘗試

import MyVuexStore from './store.js' 

或改變出口是

export const MyVuexStore = new Vuex.Store({