【发布时间】:2018-10-23 06:48:08
【问题描述】:
我正在尝试从组件外部的文件访问存储 当我搜索这个问题时,我看到人们说我应该从我的文件中导入商店,然后我可以访问它,但我无法做到这一点
我的商店是这样建造的:
const createStore = () => {
return new Vuex.Store({
state: { ... },
getters: { ... },
mutations: { ... },
actions: { ... },
})
}
我已经尝试将它导入到我的 js 文件中,就像我看到的推荐的那样
import store from '@/store'
有什么想法吗?
【问题讨论】: