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.
27 lines
486 B
27 lines
486 B
5 years ago
|
const mutations = {
|
||
|
/**
|
||
|
* 设置存储token
|
||
|
* @param {object} state
|
||
|
* @param {string} token
|
||
|
*/
|
||
|
setToken(state, token) {
|
||
|
if (!token) return;
|
||
|
state.token = token;
|
||
|
uni.setStorageSync('token', token);
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 设置user数据
|
||
|
* @param {object} state
|
||
|
* @param {object} user
|
||
|
*/
|
||
|
setUser(state, user) {
|
||
|
if (!user) return;
|
||
|
state.user = { ...user };
|
||
|
uni.setStorageSync('user', JSON.stringify(user));
|
||
|
},
|
||
|
|
||
|
};
|
||
|
|
||
|
export default mutations;
|