|
@@ -29,7 +29,14 @@ export const usePermissionStore = defineStore("pure-permission", {
|
|
|
const merged = this.constantMenus.concat(routes);
|
|
const merged = this.constantMenus.concat(routes);
|
|
|
const pathMap = new Map<string, any>();
|
|
const pathMap = new Map<string, any>();
|
|
|
for (const r of merged as any[]) {
|
|
for (const r of merged as any[]) {
|
|
|
- if (!pathMap.has(r.path) || r.meta?.backstage) {
|
|
|
|
|
|
|
+ if (!pathMap.has(r.path)) {
|
|
|
|
|
+ pathMap.set(r.path, r);
|
|
|
|
|
+ } else if (r.meta?.backstage) {
|
|
|
|
|
+ // 后端路由覆盖静态路由时,若后端无 rank 则继承静态的 rank
|
|
|
|
|
+ const existing = pathMap.get(r.path);
|
|
|
|
|
+ if (r.meta?.rank == null && existing?.meta?.rank != null) {
|
|
|
|
|
+ r.meta.rank = existing.meta.rank;
|
|
|
|
|
+ }
|
|
|
pathMap.set(r.path, r);
|
|
pathMap.set(r.path, r);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|