import Vue from 'vue' import Vuex from 'vuex' import user from '@/store/modules/user' import getters from './getters' import createPersistedState from 'vuex-persistedstate' // 引入数据持久化插件 Vue.use(Vuex) const store = new Vuex.Store({ plugins: [createPersistedState({ storage: { getItem: key => uni.getStorageSync(key), setItem: (key, value) => uni.setStorageSync(key, value), removeItem: key => uni.removeStorageSync(key) } })], modules: { user }, getters }) export default store