import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from "vuex-persistedstate";
Vue.use(Vuex)
// 引入子状态
import user from './modules/user.js'
// 初始化状态
Vue.use(Vuex)
export default new Vuex.Store({
	modules: {
		user
	},
	plugins: [
		createPersistedState({
			// 持久化的数据↓
			paths: ['user.userInfo'],
			storage: {
				getItem: (key) => uni.getStorageSync(key),
				setItem: (key, value) => uni.setStorageSync(key, value),
				removeItem: (key) => uni.removeStorageSync(key)
			}
		})
	]
})