fix(projects): 修复登录的重定向地址
This commit is contained in:
20
src/hooks/common/useRouteQuery.ts
Normal file
20
src/hooks/common/useRouteQuery.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { computed } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { RouteNameMap } from '@/router';
|
||||
|
||||
export default function useRouteQuery() {
|
||||
const route = useRoute();
|
||||
|
||||
/** 登录跳转链接 */
|
||||
const loginRedirectUrl = computed(() => {
|
||||
let url = '';
|
||||
if (route.name === RouteNameMap.get('login')) {
|
||||
url = (route.query?.redirectUrl as string) ?? '';
|
||||
}
|
||||
return url;
|
||||
});
|
||||
|
||||
return {
|
||||
loginRedirectUrl
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user