[error] namespace.replace 添加提示

This commit is contained in:
神仙 2024-07-29 23:24:37 +08:00
parent 018b8c5391
commit 4de876c0e9

View File

@ -38,14 +38,18 @@ export const useMenuStore = defineStore("menu", function () {
function deep(d: any) { function deep(d: any) {
if (typeof d == "object") { if (typeof d == "object") {
if (d.permission) { if (d.permission) {
d._permission = {}; if (d.namespace) {
for (const i in d.permission) { d._permission = {};
d._permission[i] = for (const i in d.permission) {
list.findIndex((e: any) => d._permission[i] =
e list.findIndex((e) =>
.replace(/:/g, "/") e
.includes(`${d.namespace.replace("admin/", "")}/${i}`) .replace(/:/g, "/")
) >= 0; .includes(`${d.namespace.replace("admin/", "")}/${i}`)
) >= 0;
}
} else {
console.error("namespace is required", d);
} }
} else { } else {
for (const i in d) { for (const i in d) {