mirror of
https://gitee.com/honghuangdc/soybean-admin-element-plus.git
synced 2025-12-30 10:22:25 +00:00
25 lines
680 B
TypeScript
25 lines
680 B
TypeScript
import ElegantVueRouter from '@elegant-router/vue/vite';
|
|
import type { RouteKey } from '@elegant-router/types';
|
|
|
|
export function setupElegantRouter() {
|
|
return ElegantVueRouter({
|
|
layouts: {
|
|
base: 'src/layouts/base-layout/index.vue',
|
|
blank: 'src/layouts/blank-layout/index.vue'
|
|
},
|
|
routePathTransformer(routeName, routePath) {
|
|
const key = routeName as RouteKey;
|
|
|
|
if (key === 'login') {
|
|
const modules: UnionKey.LoginModule[] = ['pwd-login', 'code-login', 'register', 'reset-pwd', 'bind-wechat'];
|
|
|
|
const moduleReg = modules.join('|');
|
|
|
|
return `/login/:module(${moduleReg})?`;
|
|
}
|
|
|
|
return routePath;
|
|
}
|
|
});
|
|
}
|