From b8ced8ec593ad002e06173952acf73f405926bd9 Mon Sep 17 00:00:00 2001 From: AliooWang <64893838+AliooWang@users.noreply.github.com> Date: 星期一, 14 四月 2025 16:56:43 +0800 Subject: [PATCH] Merge pull request #60 from zhitan-cloud/jiayu1.0 --- zhitan-vue/src/store/modules/permission.js | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/zhitan-vue/src/store/modules/permission.js b/zhitan-vue/src/store/modules/permission.js index 4eb8185..5613f1c 100644 --- a/zhitan-vue/src/store/modules/permission.js +++ b/zhitan-vue/src/store/modules/permission.js @@ -120,7 +120,18 @@ // 璁剧疆鐖惰矾鐢卞紩鐢� c.parent = el; - c.path = el.path + '/' + c.path + // 纭繚璺緞鏍煎紡姝g‘鎷兼帴 + if (el.path) { + if (c.path.startsWith('/')) { + // 缁濆璺緞淇濇寔涓嶅彉 + // 浣嗕篃璁剧疆鍘熷鐖惰矾寰勭敤浜庤彍鍗曞鑸� + c.parentPath = el.path; + } else { + // 鐩稿璺緞闇�瑕佹嫾鎺� + c.path = el.path.endsWith('/') ? el.path + c.path : el.path + '/' + c.path; + } + } + if (c.children && c.children.length) { children = children.concat(filterChildren(c.children, c)) return @@ -134,7 +145,18 @@ // 璁剧疆鐖惰矾鐢卞紩鐢� el.parent = lastRouter; - el.path = lastRouter.path + '/' + el.path + // 纭繚璺緞鏍煎紡姝g‘鎷兼帴 + if (lastRouter.path) { + if (el.path.startsWith('/')) { + // 缁濆璺緞淇濇寔涓嶅彉 + // 浣嗕篃璁剧疆鍘熷鐖惰矾寰勭敤浜庤彍鍗曞鑸� + el.parentPath = lastRouter.path; + } else { + // 鐩稿璺緞闇�瑕佹嫾鎺� + el.path = lastRouter.path.endsWith('/') ? lastRouter.path + el.path : lastRouter.path + '/' + el.path; + } + } + if (el.children && el.children.length) { children = children.concat(filterChildren(el.children, el)) return -- Gitblit v1.9.3