Quellcode durchsuchen

fix(login): 修复重定向URL未正确处理空值的问题

当options.redirect为空时,直接使用tabbarList[0].pagePath作为默认值,避免潜在的类型错误
feige996 vor 8 Monaten
Ursprung
Commit
c0dca9f133
1 geänderte Dateien mit 6 neuen und 1 gelöschten Zeilen
  1. 6 1
      src/pages/login/login.vue

+ 6 - 1
src/pages/login/login.vue

@@ -16,7 +16,12 @@ import { ensureDecodeURIComponent } from '@/utils'
 const redirectUrl = ref('')
 onLoad((options) => {
   console.log('login options', options)
-  redirectUrl.value = ensureDecodeURIComponent(options.redirect) || tabbarList[0].pagePath
+  if (options.redirect) {
+    redirectUrl.value = ensureDecodeURIComponent(options.redirect)
+  }
+  else {
+    redirectUrl.value = tabbarList[0].pagePath
+  }
 })
 const userStore = useUserStore()
 function doLogin() {