refactor: 修改路由转换部分逻辑

This commit is contained in:
xlsea 2025-05-13 22:45:59 +08:00
parent 6c3c22a2b3
commit 7511fcbd51
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
# backend service base url, test environment
VITE_SERVICE_BASE_URL=http://127.0.0.1:8080
VITE_SERVICE_BASE_URL=https://ruoyi.xlsea.cn/prod-api
VITE_APP_BASE_API=/dev-api

View File

@ -91,16 +91,16 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
function parseRouter(route: ElegantConstRoute, parent?: ElegantConstRoute) {
if (authRouteMode.value === 'dynamic') {
if (route.component === 'Layout' && route.path === '/' && route.children?.length) {
Object.assign(route, route.children[0]);
}
// @ts-expect-error no query field
const query = route.query ? String(route.query) : undefined;
route.path = route.path.startsWith('//') ? route.path.substring(1) : route.path;
route.path = parent ? parent.path + route.path : route.path;
const name = humpToLine(route.path.substring(1).replace('/', '_'));
// route.name = route.component!;
// if (['layout.base', 'iframe-page'].includes(route.component!)) {
const name = humpToLine(route.path.substring(1).replace('/', '_'));
route.name = parent ? `${parent.name}_${name}` : name;
// }
route.meta = route.meta ? route.meta : { title: route.name };