diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 7b9a9f2b..8f228da9 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -407,6 +407,6 @@ const msg = { detail: "Detail", marketplace: "Marketplace", menus: "Menus", - saveReload: "Save and reload page", + saveReload: "Save and reload the page", }; export default msg; diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index 5b170be5..80cff982 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -406,6 +406,6 @@ const msg = { detail: "Detail", marketplace: "Marketplace", menus: "Menus", - saveReload: "Save and reload page", + saveReload: "Save and reload the page", }; export default msg; diff --git a/src/router/layer.ts b/src/router/layer.ts index bc39e20d..d5d4bf96 100644 --- a/src/router/layer.ts +++ b/src/router/layer.ts @@ -16,11 +16,12 @@ */ import Layout from "@/layout/Index.vue"; import { useAppStoreWithOut } from "@/store/modules/app"; +import type { MenuOptions } from "@/types/app"; async function layerDashboards() { const appStore = useAppStoreWithOut(); await appStore.getActivateMenus(); - const routes = appStore.currentMenus.map((item: any) => { + const routes = appStore.currentMenus.map((item: MenuOptions) => { const route: any = { path: "", name: item.name, @@ -33,7 +34,7 @@ async function layerDashboards() { children: item.subItems && item.subItems.length ? [] : undefined, }; for (const child of item.subItems || []) { - const d: any = { + const d = { name: child.name, path: child.path, meta: { @@ -41,18 +42,18 @@ async function layerDashboards() { layer: child.layer, icon: child.icon || "cloud_queue", }, + component: () => import("@/views/Layer.vue"), }; - d.component = () => import("@/views/Layer.vue"); route.children.push(d); - const tab: any = { + const tab = { name: `${child.name}ActiveTabIndex`, path: `/${child.name}/tab/:activeTabIndex`, + component: () => import("@/views/Layer.vue"), meta: { notShow: true, layer: child.layer, }, }; - tab.component = () => import("@/views/Layer.vue"); route.children.push(tab); } if (!item.subItems.length) { diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index a22298dd..d0a7aa66 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -22,7 +22,7 @@ import getLocalTime from "@/utils/localtime"; import type { AxiosResponse } from "axios"; import dateFormatStep, { dateFormatTime } from "@/utils/dateFormat"; import { TimeType } from "@/constants/data"; -import type { MenuOptions } from "@/types/app"; +import type { MenuOptions, SubItem } from "@/types/app"; /*global Nullable*/ interface AppState { durationRow: Recordable; @@ -180,7 +180,7 @@ export const appStore = defineStore({ d.id = d.name; if (d.subItems && d.subItems.length) { d.hasGroup = true; - d.subItems = d.subItems.map((item: any, sub: number) => { + d.subItems = d.subItems.map((item: SubItem, sub: number) => { const id = `${item.title.replace(/\s+/g, "-")}`; item.name = `${id}-${index}${sub}`; item.path = `/${t}/${id}`; @@ -193,7 +193,7 @@ export const appStore = defineStore({ }); this.activateMenus = menus.filter((d: MenuOptions) => { if (d.activate) { - d.subItems = d.subItems.filter((item: any) => { + d.subItems = d.subItems.filter((item: SubItem) => { if (item.activate) { return item; } diff --git a/src/types/app.d.ts b/src/types/app.d.ts index c244348b..aa316043 100644 --- a/src/types/app.d.ts +++ b/src/types/app.d.ts @@ -56,14 +56,16 @@ export interface MenuOptions { path?: string; hasGroup?: boolean; id?: string; - subItems: { - layer: string; - icon: string; - title: string; - activate: boolean; - name?: string; - path?: string; - notShow?: boolean; - id?: string; - }[]; + subItems: SubItem[]; +} + +export interface SubItem { + layer: string; + icon: string; + title: string; + activate: boolean; + name?: string; + path?: string; + notShow?: boolean; + id?: string; } diff --git a/src/views/marketplace/Menus.vue b/src/views/marketplace/Menus.vue index d7573134..efe23f92 100644 --- a/src/views/marketplace/Menus.vue +++ b/src/views/marketplace/Menus.vue @@ -14,16 +14,16 @@ See the License for the specific language governing permissions and limitations under the License. -->