bmp-layout 0.0.25-beta.4 → 0.0.25-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bmp-layout.es.js +29 -6
- package/bmp-layout.umd.js +3 -3
- package/package.json +1 -1
- package/style.css +1 -1
package/bmp-layout.es.js
CHANGED
|
@@ -1217,6 +1217,18 @@ function buildChildPaths(router) {
|
|
|
1217
1217
|
return { ...child, path: `${parentPath}${childPath}` };
|
|
1218
1218
|
});
|
|
1219
1219
|
}
|
|
1220
|
+
function prependPathToRoutes(routes, parentPath) {
|
|
1221
|
+
if (!parentPath || !routes)
|
|
1222
|
+
return routes;
|
|
1223
|
+
return routes.map((route) => {
|
|
1224
|
+
const newPath = parentPath + (route.path.startsWith("/") ? route.path : `/${route.path}`);
|
|
1225
|
+
return {
|
|
1226
|
+
...route,
|
|
1227
|
+
path: newPath,
|
|
1228
|
+
children: route.children ? prependPathToRoutes(route.children, newPath) : route.children
|
|
1229
|
+
};
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1220
1232
|
function mergeExampleRoutes(targetModule, exampleRoutes, position = "start") {
|
|
1221
1233
|
if (!exampleRoutes || exampleRoutes.length === 0)
|
|
1222
1234
|
return;
|
|
@@ -1303,14 +1315,19 @@ const usePermissionStore = defineStore("layout-permission", {
|
|
|
1303
1315
|
this.leftMenuRouters = routers;
|
|
1304
1316
|
},
|
|
1305
1317
|
// 处理模块对应菜单
|
|
1318
|
+
// 返回修改后的 exampleRoutes(已拼接模块路径前缀),供路由注册使用
|
|
1306
1319
|
setModuleRouters(menuId, exampleRoutes = [], examplePosition = "start") {
|
|
1307
1320
|
const findRouter = findRouterBy(this.getRoleRouters, "id", menuId);
|
|
1308
1321
|
if (findRouter) {
|
|
1309
1322
|
this.moduleId = findRouter.id;
|
|
1310
1323
|
this.moduleName = findRouter.name;
|
|
1311
1324
|
this.moduleRouters = buildChildPaths(findRouter);
|
|
1312
|
-
|
|
1325
|
+
const parentPath = findRouter.path || "";
|
|
1326
|
+
const prefixedExampleRoutes = prependPathToRoutes(exampleRoutes, parentPath);
|
|
1327
|
+
mergeExampleRoutes(findRouter, prefixedExampleRoutes, examplePosition);
|
|
1328
|
+
return prefixedExampleRoutes;
|
|
1313
1329
|
}
|
|
1330
|
+
return exampleRoutes;
|
|
1314
1331
|
},
|
|
1315
1332
|
resetState() {
|
|
1316
1333
|
this.routers = [];
|
|
@@ -1323,14 +1340,19 @@ const usePermissionStore = defineStore("layout-permission", {
|
|
|
1323
1340
|
this.roleRouters = [];
|
|
1324
1341
|
},
|
|
1325
1342
|
// 处理模块对应菜单(通过模块code)
|
|
1343
|
+
// 返回修改后的 exampleRoutes(已拼接模块路径前缀),供路由注册使用
|
|
1326
1344
|
setModuleRoutersByCode(moduleCode, exampleRoutes = [], examplePosition = "start") {
|
|
1327
1345
|
const findRouter = findRouterBy(this.getRoleRouters, "moduleCode", moduleCode);
|
|
1328
1346
|
if (findRouter) {
|
|
1329
1347
|
this.moduleId = findRouter.id;
|
|
1330
1348
|
this.moduleName = findRouter.name;
|
|
1331
1349
|
this.moduleRouters = buildChildPaths(findRouter);
|
|
1332
|
-
|
|
1350
|
+
const parentPath = findRouter.path || "";
|
|
1351
|
+
const prefixedExampleRoutes = prependPathToRoutes(exampleRoutes, parentPath);
|
|
1352
|
+
mergeExampleRoutes(findRouter, prefixedExampleRoutes, examplePosition);
|
|
1353
|
+
return prefixedExampleRoutes;
|
|
1333
1354
|
}
|
|
1355
|
+
return exampleRoutes;
|
|
1334
1356
|
}
|
|
1335
1357
|
},
|
|
1336
1358
|
persist: false
|
|
@@ -8706,13 +8728,14 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ name: "ProductServicePanel"
|
|
|
8706
8728
|
const normalizedPath = fullPath.startsWith("/") ? fullPath : `/${fullPath}`;
|
|
8707
8729
|
const currentModuleId = permissionStore.getModuleId;
|
|
8708
8730
|
const selectedModuleId = (_b = (_a2 = productList.value[activeProductIndex.value]) == null ? void 0 : _a2.children[activeModuleIndex.value]) == null ? void 0 : _b.id;
|
|
8709
|
-
if (selectedModuleId === currentModuleId
|
|
8731
|
+
if (selectedModuleId === currentModuleId) {
|
|
8710
8732
|
router.push(normalizedPath);
|
|
8711
8733
|
} else {
|
|
8712
8734
|
const currentOrigin = window.location.origin;
|
|
8713
8735
|
const modulePath = ((_d = (_c = productList.value[activeProductIndex.value]) == null ? void 0 : _c.children[activeModuleIndex.value]) == null ? void 0 : _d.modulePath) || "";
|
|
8714
|
-
const
|
|
8715
|
-
const
|
|
8736
|
+
const hasModulePrefix = modulePath && (fullPath === modulePath || fullPath.startsWith(modulePath + "/"));
|
|
8737
|
+
const finalPath = hasModulePrefix ? normalizedPath : `${modulePath}${normalizedPath}`;
|
|
8738
|
+
const targetUrl = `${currentOrigin}${finalPath.startsWith("/") ? finalPath : `/${finalPath}`}`;
|
|
8716
8739
|
window.location.href = targetUrl;
|
|
8717
8740
|
}
|
|
8718
8741
|
closePanel();
|
|
@@ -8968,7 +8991,7 @@ const _sfc_main$r = /* @__PURE__ */ Object.assign({ name: "ProductServicePanel"
|
|
|
8968
8991
|
};
|
|
8969
8992
|
}
|
|
8970
8993
|
});
|
|
8971
|
-
const ProductServicePanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-
|
|
8994
|
+
const ProductServicePanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__scopeId", "data-v-808cd98e"]]);
|
|
8972
8995
|
const _sfc_main$q = /* @__PURE__ */ Object.assign({ name: "Logo" }, {
|
|
8973
8996
|
__name: "Logo",
|
|
8974
8997
|
emits: ["logo-click"],
|