Update routeHelper.ts

菜单访问地址动态参数路由支持
pull/8723/head
dreamcc 2025-08-18 13:01:32 +08:00 committed by GitHub
parent 6ace7eae8a
commit c17567ac9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 0 deletions

View File

@ -57,6 +57,26 @@ function asyncImportRoute(routes: AppRouteRecordRaw[] | undefined) {
}
// @ts-ignore
item.meta.ignoreKeepAlive = !item?.meta.keepAlive;
// query -
if (item.path && item.path.includes('?')) {
const [basePath, queryString] = item.path.split('?');
item.path = basePath; // Vue Routerpath
// querymeta使
if (queryString) {
const queryParams: Record<string, string> = {};
queryString.split('&').forEach((param) => {
const [key, value] = param.split('=');
if (key) {
queryParams[decodeURIComponent(key)] = decodeURIComponent(value || '');
}
});
item.meta = item.meta || {};
item.meta.queryParams = queryParams;
}
}
let token = getToken();
let tenantId = getTenantId();
// URL{{ window.xxx }}