2017-05-12 3 views

답변

0

그것은 그 export default에 의한 작품. const를 직접 내보내보십시오.

는 예 :

store.js

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

Vue.use(Vuex); 

export const store = new Vuex.Store({ 
    state: { 
    //your code here// 
    } 
}); 

Main.js

import 'store' from 'wherever the file is/mystore.js'; 

new Vue({ 
    el: '#app', 
    store, <-- Here is defined store to use along the my app 
    render: h => h(App) 
}); 
+0

당신이 도움을 위해 나는 매우 감사하고있어, 작동, 그것은 몇 일 동안 내 퍼즐을 해결 , 그러나 나는'export default'를 사용할 때 실수를 범할 때 여전히 혼란 스럽다. ''export default''를 쓰면 어떻게 쓰는지 – whyang

+0

'''export {store}'''를 사용하면 괜찮습니다. es6 모듈을주의 깊게 읽어야합니다. 다시 한 번 지시를 주셔서 감사합니다. – whyang