index.js 769 字节
Newer Older
M
MicroMilo 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
import app from './modules/app.js'
import error from './modules/error.js'
import user from './modules/user.js'

// const modulesFiles = require.context('./modules', true, /\.js$/)
// const modules = modulesFiles.keys().reduce((modules, modulePath) => {
//     const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
//     const value = modulesFiles(modulePath)
//     modules[moduleName] = value.default
//     return modules
// }, {})

// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
	modules: {
		app,
		error,
		user
	}
})
// #endif

// #ifdef VUE3
import {
	createStore
} from 'vuex'
// todo ssr
const store = createStore({
	modules: {
		app,
		error,
		user
	}
})
// #endif


export default store