Explorar el Código

用户信息控制判断

@dongkboy hace 5 meses
padre
commit
5076da5f40
Se han modificado 1 ficheros con 1 adiciones y 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 token = ref(localStorage.token ?? '')
     const avatar = ref(localStorage.avatar ?? '')
     const avatar = ref(localStorage.avatar ?? '')
     const userInfo = ref(localStorage.userInfo ?? '')
     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 permissions = ref<string[]>([])
     const staticRouter = ref<string[]>([])
     const staticRouter = ref<string[]>([])
     const isLogin = computed(() => {
     const isLogin = computed(() => {