diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 2fad24e..a69c94c 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -9,7 +9,7 @@ const InitUserInfo = { export const useUserStore = defineStore('user', { state: () => ({ token: localStorage.getItem(TOKEN_NAME) || 'main_token', // 默认token不走权限 - userInfo: InitUserInfo, + userInfo: { ...InitUserInfo }, }), getters: { roles: (state) => { @@ -73,7 +73,7 @@ export const useUserStore = defineStore('user', { async logout() { localStorage.removeItem(TOKEN_NAME); this.token = ''; - this.userInfo = InitUserInfo; + this.userInfo = { ...InitUserInfo }; }, async removeToken() { this.token = '';