mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-12-25 14:20:21 +08:00
refactor(projects): 完善路由配置
This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
import { useRouter } from 'vue-router';
|
||||
import { EnumRoutePaths } from '@/enum';
|
||||
import { EnumRoutePath } from '@/enum';
|
||||
import { RouteNameMap } from '@/router';
|
||||
import type { LoginModuleType } from '@/interface';
|
||||
|
||||
export default function useRouterChange() {
|
||||
const router = useRouter();
|
||||
|
||||
/** 跳转首页 */
|
||||
function toHome() {
|
||||
router.push('/');
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转登录页面(通过vue路由)
|
||||
* @param module - 展示的登录模块
|
||||
@@ -28,7 +33,7 @@ export default function useRouterChange() {
|
||||
* @param redirectUrl - 登录后重定向的页面路径
|
||||
*/
|
||||
function toLoginByLocation(module: LoginModuleType = 'pwd-login', redirectUrl?: string) {
|
||||
let href = `${window.location.origin + EnumRoutePaths.login}/${module}`;
|
||||
let href = `${window.location.origin + EnumRoutePath.login}/${module}`;
|
||||
if (redirectUrl) {
|
||||
href += redirectUrl;
|
||||
}
|
||||
@@ -36,6 +41,7 @@ export default function useRouterChange() {
|
||||
}
|
||||
|
||||
return {
|
||||
toHome,
|
||||
toLogin,
|
||||
toLoginByLocation
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user