这样写获取不到
但是在main.js中是用这种方法获取的,可以获取到
import axios from 'axios' import store from '@/store' console.log(store)// undefined
下面这样写能获取到
import axios from 'axios'const store = require('@/store') console.log(store) //可以获取
这是store下的index
import Vue from 'vue' import Vuex from 'vuex' import login from './modules/login' import getArticleList from './modules/getArticleList'// import createLogger from 'vuex/dist/logger'Vue.use(Vuex) const debug = process.env.NODE_ENV !== 'production'export default new Vuex.Store({ modules: { login, getArticleList }, strict: debug // plugins: debug ? [createLogger()] : [] })
qq_LAL_2
守着一只汪
潇湘沐