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",
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: "",

View File

@ -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",

View File

@ -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 "偷偷向银河要了一把碎星,只等你闭上眼睛撒入你的梦中,晚安🌛!";
}
});

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>