diff --git a/components.d.ts b/components.d.ts index f0a9ef2a4b007f20450534581b81b57da129fde7..d30c04c2cf6f6aab8d7eb7aa83c87475ae1e3f74 100644 --- a/components.d.ts +++ b/components.d.ts @@ -18,6 +18,7 @@ declare module '@vue/runtime-core' { LayConfigProvider: typeof import('@layui/layui-vue')['LayConfigProvider'] LayContainer: typeof import('@layui/layui-vue')['LayContainer'] LayCountUp: typeof import('@layui/layui-vue')['LayCountUp'] + LayDatePicker: typeof import('@layui/layui-vue')['LayDatePicker'] LayDropdown: typeof import('@layui/layui-vue')['LayDropdown'] LayDropdownMenu: typeof import('@layui/layui-vue')['LayDropdownMenu'] LayDropdownMenuItem: typeof import('@layui/layui-vue')['LayDropdownMenuItem'] @@ -34,7 +35,6 @@ declare module '@vue/runtime-core' { LayLogo: typeof import('@layui/layui-vue')['LayLogo'] LayMenu: typeof import('@layui/layui-vue')['LayMenu'] LayMenuItem: typeof import('@layui/layui-vue')['LayMenuItem'] - LayPage: typeof import('@layui/layui-vue')['LayPage'] LayProgress: typeof import('@layui/layui-vue')['LayProgress'] LayRadio: typeof import('@layui/layui-vue')['LayRadio'] LayRow: typeof import('@layui/layui-vue')['LayRow'] diff --git a/src/layouts/Global/GlobalContent.vue b/src/layouts/Global/GlobalContent.vue index a6f849e04fc126551bee518b4de9ee77b26f4d55..d7081f2001c217c44f0f3655a728a5a0f22afc3b 100644 --- a/src/layouts/Global/GlobalContent.vue +++ b/src/layouts/Global/GlobalContent.vue @@ -1,8 +1,12 @@ diff --git a/src/layouts/composable/useTab.ts b/src/layouts/composable/useTab.ts index 073feddf0b9d5fc6ea91c53302cf71de54f56606..9353aa4b8185d676ff0710252bb7c99ab2773c7d 100644 --- a/src/layouts/composable/useTab.ts +++ b/src/layouts/composable/useTab.ts @@ -1,11 +1,13 @@ import { computed, Ref, ref, watch } from "vue"; import { useRoute, useRouter } from "vue-router"; +import {useAppStore} from "../../store/app"; export function useTab() { const route = useRoute(); const router = useRouter(); const routes = router.getRoutes() const currentPath = computed(() => route.path); + const appStore = useAppStore(); const tabs: Ref = ref([]); const tabsCache: string[] = [] @@ -16,6 +18,7 @@ export function useTab() { tabs.value.push({ ...route.meta, id: route.path, + name: route?.name }) tabsCache.push(route.path) } @@ -27,6 +30,7 @@ export function useTab() { path && tabs.value.push({ ...path.meta, id: route.path, + name: route?.name, }) } @@ -62,8 +66,11 @@ export function useTab() { } }); if (!bool) { - tabs.value.push({ id: route.fullPath, title: route.meta.title }); + tabs.value.push({ id: route.fullPath, title: route.meta.title, name: route?.name }); } + appStore.$patch((state)=> { + state.keepAliveList = tabs.value.map((item: any) => item?.name).filter((item: any)=> item) + }) }); return { diff --git a/src/router/module/base-routes.ts b/src/router/module/base-routes.ts index 444ec7bb1a5d0b9d5a6ffe6150b3dee81f07b3e2..89bb6fced95a85a042d9be745c777dbe1780020e 100644 --- a/src/router/module/base-routes.ts +++ b/src/router/module/base-routes.ts @@ -20,6 +20,7 @@ export default [ children: [ { path: '/workspace/workbench', + name: 'Workbench', component: () => import('../../views/workSpace/workbench/index.vue'), meta: { title: '工作台', requireAuth: true, affix: true, closable: false }, }, @@ -130,6 +131,7 @@ export default [ }, { path: '/form/intricate', + name: 'Intricate', component: () => import('../../views/form/intricate.vue'), meta: { title: '复杂表单', requireAuth: true }, }, diff --git a/src/store/app.ts b/src/store/app.ts index 89d2d3d65bbf600d45cfe2066d24fc888d342ddf..a94ab56ffe608e70cc03fc75300af4cdef177a47 100644 --- a/src/store/app.ts +++ b/src/store/app.ts @@ -15,6 +15,7 @@ export const useAppStore = defineStore({ sideTheme: 'dark', greyMode: false, accordion: true, + keepAliveList: [], themeVariable: { "--global-checked-color": "#5fb878", "--global-primary-color": "#009688", @@ -26,6 +27,6 @@ export const useAppStore = defineStore({ }, persist: { storage: localStorage, - paths: ['tab', 'theme', 'logo', 'level', 'inverted', 'breadcrumb', 'sideTheme', 'greyMode', 'accordion' , 'themeVariable'], + paths: ['tab', 'theme', 'logo', 'level', 'inverted', 'breadcrumb', 'sideTheme', 'greyMode', 'accordion' ,'keepAliveList', 'themeVariable'], } }) \ No newline at end of file diff --git a/src/views/form/intricate.vue b/src/views/form/intricate.vue index 099c4ff22d6d9936ae1a9ef1e3d297914f75a3fa..dd16f52147d3f8f122de551ddd8a2f2e9f23c513 100644 --- a/src/views/form/intricate.vue +++ b/src/views/form/intricate.vue @@ -262,6 +262,7 @@ import { ref, watch, reactive } from 'vue'; import { layer } from '@layui/layer-vue'; export default { + name: 'Intricate', setup() { // 表格列 const columns = [ diff --git a/src/views/workSpace/analysis/index.vue b/src/views/workSpace/analysis/index.vue index f84f0a5724e4860ae1486df0358f1250d748aa7a..1f02254a5d320e07c602708b0934fe202a248eb0 100644 --- a/src/views/workSpace/analysis/index.vue +++ b/src/views/workSpace/analysis/index.vue @@ -144,6 +144,7 @@ import { defineComponent, ref, onMounted } from "vue"; import * as echarts from 'echarts'; export default defineComponent({ + name: 'Analysis', setup() { const mainRef = ref()