You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shop-app/common/store/index.js

31 lines
613 B

3 years ago
/*
* @Author: ch
* @Date: 2022-03-22 18:28:52
* @LastEditors: ch
* @LastEditTime: 2022-03-30 16:58:03
3 years ago
* @Description: file content
*/
import Vue from 'vue'
import Vuex from 'vuex';
3 years ago
Vue.use(Vuex)
3 years ago
export default new Vuex.Store({
state : {
token : uni.getStorageSync('tk') || '',
userInfo : JSON.parse(uni.getStorageSync('ui') || '{}')
3 years ago
},
mutations:{
SET_TOKEN (state, token = ''){
state.token = token;
uni.setStorageSync('tk', token);
},
SET_USER_INFO (state, userInfo = {}){
state.userInfo = userInfo;
uni.setStorageSync('ui', JSON.stringify(userInfo));
}
3 years ago
},
getters:{
}
})