- was not introduced to the directory folder that should be released;
- store in src/store/index.js?
import Vue from 'vue'
import Vuex from 'vuex'
const state={ ...}
...
Vue.use(Vuex)
const store = new Vuex.Store({
state,
getters,
actions,
mutations
})
export default store
import store from '@/store'
xxx = store.getters.token
const store = require ('.. / store/index');
console.log (store); / / Store {_ committing: false, _ actions: { .
but you can import
using the require method.
has it been solved? I also encountered this problem.
my store/index:
import Vue from 'vue'
import Vuex from 'vuex'
import app from './modules/app'
import user from './modules/user'
import getters from './getters'
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
app,
user
},
getters
})
export default store
notice that there is a import user from'. / modules/user'
above and modules/user.js says this:
import { login, logout, getInfo } from '@/api/login'
the following interface is quoted here. Remove this sentence and then be fine. It's strange, but it's definitely illogical.
have you solved it
?