refactor: 修改路由转换部分逻辑
This commit is contained in:
parent
6c3c22a2b3
commit
7511fcbd51
2
.env.dev
2
.env.dev
@ -1,5 +1,5 @@
|
|||||||
# backend service base url, test environment
|
# 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
|
VITE_APP_BASE_API=/dev-api
|
||||||
|
|
||||||
|
@ -91,16 +91,16 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
|||||||
|
|
||||||
function parseRouter(route: ElegantConstRoute, parent?: ElegantConstRoute) {
|
function parseRouter(route: ElegantConstRoute, parent?: ElegantConstRoute) {
|
||||||
if (authRouteMode.value === 'dynamic') {
|
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
|
// @ts-expect-error no query field
|
||||||
const query = route.query ? String(route.query) : undefined;
|
const query = route.query ? String(route.query) : undefined;
|
||||||
route.path = route.path.startsWith('//') ? route.path.substring(1) : route.path;
|
route.path = route.path.startsWith('//') ? route.path.substring(1) : route.path;
|
||||||
route.path = parent ? parent.path + route.path : 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.name = parent ? `${parent.name}_${name}` : name;
|
||||||
|
// }
|
||||||
|
|
||||||
route.meta = route.meta ? route.meta : { title: route.name };
|
route.meta = route.meta ? route.meta : { title: route.name };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user