Browse Source

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

当options.redirect为空时,直接使用tabbarList[0].pagePath作为默认值,避免潜在的类型错误
feige996 8 months ago
parent
commit
c0dca9f133
1 changed files with 6 additions and 1 deletions
  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() {