53 lines
1.1 KiB
Vue
53 lines
1.1 KiB
Vue
<script setup lang="ts">
|
|
import { RouterView } from "vue-router";
|
|
import { onMounted } from 'vue';
|
|
|
|
// 需要缓存的组件名称列表
|
|
const cachedViews = [
|
|
'Dashboard',
|
|
'WechatConfig',
|
|
'WechatTemplates',
|
|
'WechatLogs',
|
|
'UserManagement',
|
|
'RoleManagement',
|
|
'PermissionManagement',
|
|
// 实时监控类组件不适合做缓存,每次访问需要重新初始化连接和状态
|
|
// 'DroneManagement',
|
|
'CameraManagement',
|
|
'SensorManagement'
|
|
]
|
|
|
|
onMounted(() => {
|
|
document.title = 'AI智慧平台 - 智能管理系统';
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<router-view v-slot="{ Component }">
|
|
<keep-alive :include="cachedViews">
|
|
<component :is="Component" />
|
|
</keep-alive>
|
|
</router-view>
|
|
</template>
|
|
|
|
<style lang="scss">
|
|
@use "./styles/variables" as v;
|
|
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
height: 100%;
|
|
background-color: v.$bg-color;
|
|
color: v.$text-primary;
|
|
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
|
|
"Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
|
-webkit-font-smoothing: antialiased;
|
|
-moz-osx-font-smoothing: grayscale;
|
|
}
|
|
|
|
#app {
|
|
height: 100%;
|
|
}
|
|
</style>
|