diff --git a/mock/router.ts b/mock/router.ts index 3e9eef3e..d4d830d1 100644 --- a/mock/router.ts +++ b/mock/router.ts @@ -67,7 +67,7 @@ const data = { { path: "dict", component: "system/dict/index", - name: "Dict", + name: "DictType", meta: { title: "字典管理", icon: "dict", @@ -98,7 +98,7 @@ const data = { icon: "api", hidden: false, roles: ["ADMIN"], - keepAlive: true, + keepAlive: false, }, }, ], @@ -207,7 +207,7 @@ const data = { { path: "wang-editor", component: "demo/wang-editor", - name: "WangEditor", + name: "wang-editor", meta: { title: "富文本编辑器", icon: "", @@ -219,7 +219,7 @@ const data = { { path: "upload", component: "demo/upload", - name: "Upload", + name: "upload", meta: { title: "图片上传", icon: "", @@ -231,7 +231,7 @@ const data = { { path: "icon-selector", component: "demo/icon-selector", - name: "IconSelector", + name: "icon-selector", meta: { title: "图标选择器", icon: "", @@ -255,7 +255,7 @@ const data = { { path: "taginput", component: "demo/taginput", - name: "Taginput", + name: "taginput", meta: { title: "标签输入框", icon: "", @@ -267,7 +267,7 @@ const data = { { path: "signature", component: "demo/signature", - name: "Signature", + name: "signature", meta: { title: "签名", icon: "", diff --git a/src/router/index.ts b/src/router/index.ts index eed91440..6df76e4a 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -30,8 +30,14 @@ export const constantRoutes: RouteRecordRaw[] = [ { path: "dashboard", component: () => import("@/views/dashboard/index.vue"), - name: "Dashboard", - meta: { title: "dashboard", icon: "homepage", affix: true }, + name: "Dashboard", // 用于 keep-alive, 必须与SFC自动推导或者显示声明的组件name一致 + // https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude + meta: { + title: "dashboard", + icon: "homepage", + affix: true, + keepAlive: true, + }, }, { path: "401", @@ -46,24 +52,6 @@ export const constantRoutes: RouteRecordRaw[] = [ ], }, - { - path: "/ext", - component: Layout, - children: [ - { - path: "google", - component: import("@/views/demo/google.vue"), - name: "google", - meta: { - title: "Google", - icon: "client", - hidden: false, - roles: ["ADMIN"], - keepAlive: true, - }, - }, - ], - }, // 外部链接 // { // path: "/external-link", diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index 855755d2..0c892e68 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -3,7 +3,7 @@ import { useUserStore } from "@/store/modules/user"; import { useTransition, TransitionPresets } from "@vueuse/core"; defineOptions({ - // eslint-disable-next-line vue/no-reserved-component-names + // eslint-disable-next-line name: "Dashboard", inheritAttrs: false, }); @@ -13,15 +13,16 @@ const userStore = useUserStore(); const date: Date = new Date(); const greetings = computed(() => { - if (date.getHours() >= 6 && date.getHours() < 8) { + const hours = date.getHours(); + if (hours >= 6 && hours < 8) { return "晨起披衣出草堂,轩窗已自喜微凉🌅!"; - } else if (date.getHours() >= 8 && date.getHours() < 12) { + } else if (hours >= 8 && hours < 12) { return "上午好🌞!"; - } else if (date.getHours() >= 12 && date.getHours() < 18) { + } else if (hours >= 12 && hours < 18) { return "下午好☕!"; - } else if (date.getHours() >= 18 && date.getHours() < 24) { + } else if (hours >= 18 && hours < 24) { return "晚上好🌃!"; - } else if (date.getHours() >= 0 && date.getHours() < 6) { + } else if (hours >= 0 && hours < 6) { return "偷偷向银河要了一把碎星,只等你闭上眼睛撒入你的梦中,晚安🌛!"; } }); diff --git a/src/views/demo/google.vue b/src/views/demo/google.vue deleted file mode 100644 index b651eafc..00000000 --- a/src/views/demo/google.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - -