Browse Source

fix 修复 使用 localStorage 返回值为null问题

疯狂的狮子Li 1 year ago
parent
commit
e10f112fa0
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/views/login.vue

+ 4 - 4
src/views/login.vue

@@ -153,10 +153,10 @@ const getLoginData = () => {
   const password = localStorage.getItem('password');
   const rememberMe = localStorage.getItem('rememberMe');
   loginForm.value = {
-    tenantId: tenantId === undefined ? String(loginForm.value.tenantId) : tenantId,
-    username: username === undefined ? String(loginForm.value.username) : username,
-    password: password === undefined ? String(loginForm.value.password) : String(password),
-    rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
+    tenantId: tenantId === null ? String(loginForm.value.tenantId) : tenantId,
+    username: username === null ? String(loginForm.value.username) : username,
+    password: password === null ? String(loginForm.value.password) : String(password),
+    rememberMe: rememberMe === null ? false : Boolean(rememberMe)
   } as LoginData;
 }