@litianxiang/portal-core 0.2.1 → 0.2.3
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/dist/index.js +3 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44,12 +44,13 @@ function _findParentMenuIds(menuList, targetPath, parentIds = []) {
|
|
|
44
44
|
if (!target || !Array.isArray(menuList)) return [];
|
|
45
45
|
for (const menu of menuList) {
|
|
46
46
|
const current = normalizePath(menu?.path);
|
|
47
|
+
if (current === target) {
|
|
48
|
+
return parentIds;
|
|
49
|
+
}
|
|
47
50
|
if (menu?.children && menu.children.length > 0) {
|
|
48
51
|
const currentIds = [...parentIds, menu.id];
|
|
49
52
|
const result = _findParentMenuIds(menu.children, targetPath, currentIds);
|
|
50
53
|
if (result.length > 0) return result;
|
|
51
|
-
} else if (current === target) {
|
|
52
|
-
return parentIds;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
return [];
|