diff --git a/src/views/login.vue b/src/views/login.vue index 4a016406..bf3f4749 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -14,10 +14,6 @@ const appStore = useAppStore(); const router = useRouter(); const route = useRoute(); -/**登录后重定向页面 */ -const redirectPath = - (route.query && (route.query.redirect as string)) || '/index'; - let state = reactive({ /**表单属性 */ from: { @@ -52,7 +48,9 @@ function fnFinish() { .then(res => { if (res.code === RESULT_CODE_SUCCESS) { message.success(t('views.login.loginSuccess'), 3); - router.push({ path: redirectPath }); + /**登录后重定向页面 */ + const redirectPath = route.query?.redirect || '/index'; + router.push({ path: redirectPath as string }); } else { message.error(`${res.msg}`, 3); }