fix: update

This commit is contained in:
Fine 2023-07-10 11:55:32 +08:00
parent ccc8924d26
commit 6dc0a4a2a8
3 changed files with 11 additions and 8 deletions

View File

@ -30,7 +30,7 @@ const router = createRouter({
(window as any).axiosCancel = []; (window as any).axiosCancel = [];
const defaultPath = routesLayers[0].children[0].path; const defaultPath = (routesLayers[0] && routesLayers[0].children[0].path) || "";
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
// const token = window.localStorage.getItem("skywalking-authority"); // const token = window.localStorage.getItem("skywalking-authority");

View File

@ -25,8 +25,9 @@ async function layerDashboards() {
path: "", path: "",
component: Layout, component: Layout,
meta: { meta: {
icon: item.icon, icon: item.icon || "cloud_queue",
title: item.title, title: item.title,
hasGroup: item.hasGroup,
}, },
children: item.subItems && item.subItems.length ? [] : undefined, children: item.subItems && item.subItems.length ? [] : undefined,
}; };
@ -37,6 +38,7 @@ async function layerDashboards() {
meta: { meta: {
title: child.title, title: child.title,
layer: child.layer, layer: child.layer,
icon: child.icon || "cloud_queue",
}, },
}; };
d.component = () => import("@/views/Layer.vue"); d.component = () => import("@/views/Layer.vue");

View File

@ -172,17 +172,18 @@ export const appStore = defineStore({
); );
}, },
async getActivateMenus() { async getActivateMenus() {
// localStorage.removeItem("customMenus");
const resp = (await this.queryMenuItems()) || {}; const resp = (await this.queryMenuItems()) || {};
const menus = (resp.getMenuItems || []).map((d: MenuOptions, index: number) => { const menus = (resp.getMenuItems || []).map((d: MenuOptions, index: number) => {
const name = `${d.title.replace(/\s+/g, "-")}-${index}`; const t = `${d.title.replace(/\s+/g, "-")}`;
d.name = name; d.name = `${t}-${index}`;
d.path = `/${name}`; d.path = `/${t}`;
if (d.subItems && d.subItems.length) { if (d.subItems && d.subItems.length) {
d.hasGroup = true; d.hasGroup = true;
d.subItems = d.subItems.map((item: any, sub: number) => { d.subItems = d.subItems.map((item: any, sub: number) => {
const id = `${d.title.replace(/\s+/g, "-")}-${index}${sub}`; const id = `${item.title.replace(/\s+/g, "-")}`;
item.name = id; item.name = `${id}-${index}${sub}`;
item.path = `/${id}`; item.path = `/${t}/${id}`;
return item; return item;
}); });
} else { } else {