fix: keepalive

This commit is contained in:
Jachin 2023-08-07 10:34:31 +08:00
parent 486f65e137
commit ad33ebcbd4
4 changed files with 22 additions and 60 deletions

View File

@ -67,7 +67,7 @@ const data = {
{ {
path: "dict", path: "dict",
component: "system/dict/index", component: "system/dict/index",
name: "Dict", name: "DictType",
meta: { meta: {
title: "字典管理", title: "字典管理",
icon: "dict", icon: "dict",
@ -98,7 +98,7 @@ const data = {
icon: "api", icon: "api",
hidden: false, hidden: false,
roles: ["ADMIN"], roles: ["ADMIN"],
keepAlive: true, keepAlive: false,
}, },
}, },
], ],
@ -207,7 +207,7 @@ const data = {
{ {
path: "wang-editor", path: "wang-editor",
component: "demo/wang-editor", component: "demo/wang-editor",
name: "WangEditor", name: "wang-editor",
meta: { meta: {
title: "富文本编辑器", title: "富文本编辑器",
icon: "", icon: "",
@ -219,7 +219,7 @@ const data = {
{ {
path: "upload", path: "upload",
component: "demo/upload", component: "demo/upload",
name: "Upload", name: "upload",
meta: { meta: {
title: "图片上传", title: "图片上传",
icon: "", icon: "",
@ -231,7 +231,7 @@ const data = {
{ {
path: "icon-selector", path: "icon-selector",
component: "demo/icon-selector", component: "demo/icon-selector",
name: "IconSelector", name: "icon-selector",
meta: { meta: {
title: "图标选择器", title: "图标选择器",
icon: "", icon: "",
@ -255,7 +255,7 @@ const data = {
{ {
path: "taginput", path: "taginput",
component: "demo/taginput", component: "demo/taginput",
name: "Taginput", name: "taginput",
meta: { meta: {
title: "标签输入框", title: "标签输入框",
icon: "", icon: "",
@ -267,7 +267,7 @@ const data = {
{ {
path: "signature", path: "signature",
component: "demo/signature", component: "demo/signature",
name: "Signature", name: "signature",
meta: { meta: {
title: "签名", title: "签名",
icon: "", icon: "",

View File

@ -30,8 +30,14 @@ export const constantRoutes: RouteRecordRaw[] = [
{ {
path: "dashboard", path: "dashboard",
component: () => import("@/views/dashboard/index.vue"), component: () => import("@/views/dashboard/index.vue"),
name: "Dashboard", name: "Dashboard", // 用于 keep-alive, 必须与SFC自动推导或者显示声明的组件name一致
meta: { title: "dashboard", icon: "homepage", affix: true }, // https://cn.vuejs.org/guide/built-ins/keep-alive.html#include-exclude
meta: {
title: "dashboard",
icon: "homepage",
affix: true,
keepAlive: true,
},
}, },
{ {
path: "401", 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", // path: "/external-link",

View File

@ -3,7 +3,7 @@ import { useUserStore } from "@/store/modules/user";
import { useTransition, TransitionPresets } from "@vueuse/core"; import { useTransition, TransitionPresets } from "@vueuse/core";
defineOptions({ defineOptions({
// eslint-disable-next-line vue/no-reserved-component-names // eslint-disable-next-line
name: "Dashboard", name: "Dashboard",
inheritAttrs: false, inheritAttrs: false,
}); });
@ -13,15 +13,16 @@ const userStore = useUserStore();
const date: Date = new Date(); const date: Date = new Date();
const greetings = computed(() => { const greetings = computed(() => {
if (date.getHours() >= 6 && date.getHours() < 8) { const hours = date.getHours();
if (hours >= 6 && hours < 8) {
return "晨起披衣出草堂,轩窗已自喜微凉🌅!"; return "晨起披衣出草堂,轩窗已自喜微凉🌅!";
} else if (date.getHours() >= 8 && date.getHours() < 12) { } else if (hours >= 8 && hours < 12) {
return "上午好🌞!"; return "上午好🌞!";
} else if (date.getHours() >= 12 && date.getHours() < 18) { } else if (hours >= 12 && hours < 18) {
return "下午好☕!"; return "下午好☕!";
} else if (date.getHours() >= 18 && date.getHours() < 24) { } else if (hours >= 18 && hours < 24) {
return "晚上好🌃!"; return "晚上好🌃!";
} else if (date.getHours() >= 0 && date.getHours() < 6) { } else if (hours >= 0 && hours < 6) {
return "偷偷向银河要了一把碎星,只等你闭上眼睛撒入你的梦中,晚安🌛!"; return "偷偷向银河要了一把碎星,只等你闭上眼睛撒入你的梦中,晚安🌛!";
} }
}); });

View File

@ -1,27 +0,0 @@
<!-- 接口文档 -->
<template>
<div class="app-container">
<iframe
src="https://creator.xiaohongshu.com/"
width="100%"
height="100%"
frameborder="0"
></iframe>
</div>
</template>
<style lang="scss" scoped>
.app-container {
display: flex;
flex-direction: column;
/* 84 = navbar + tags-view = 50 + 34 */
height: calc(100vh - 50px);
}
.hasTagsView {
.app-container {
height: calc(100vh - 84px);
}
}
</style>