Explorar o código

用户信息控制判断

@dongkboy hai 5 meses
pai
achega
5076da5f40
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/store/modules/user.ts

+ 1 - 1
src/store/modules/user.ts

@@ -22,7 +22,7 @@ const useUserStore = defineStore(
     const token = ref(localStorage.token ?? '')
     const avatar = ref(localStorage.avatar ?? '')
     const userInfo = ref(localStorage.userInfo ?? '')
-    const realName = JSON.parse(userInfo.value)?.name ?? '';
+    const realName = userInfo.value ? JSON.parse(userInfo.value)?.name ?? '' : '';
     const permissions = ref<string[]>([])
     const staticRouter = ref<string[]>([])
     const isLogin = computed(() => {