30 lines
694 B
JavaScript
30 lines
694 B
JavaScript
import Vue from 'vue'
|
|
import Vuex from 'vuex'
|
|
import createPersistedState from 'vuex-persistedstate'
|
|
import state from './state'
|
|
import getters from './getters'
|
|
import mutations from './mutations'
|
|
import city from './modules/switchCity'
|
|
import shoppingCart from './modules/shoppingCart'
|
|
Vue.use(Vuex)
|
|
|
|
export default new Vuex.Store({
|
|
state,
|
|
mutations,
|
|
getters,
|
|
plugins: [
|
|
createPersistedState({
|
|
storage: {
|
|
getItem: key => uni.getStorageSync(key),
|
|
setItem: (key, value) => uni.setStorageSync(key, value),
|
|
// removeItem: key => { }
|
|
removeItem: key => uni.removeStorageSync(key)
|
|
}
|
|
})
|
|
],
|
|
modules: {
|
|
city,
|
|
shoppingCart
|
|
}
|
|
})
|