33 lines
1.1 KiB
Vue
33 lines
1.1 KiB
Vue
<template>
|
|
<!-- 契约壳层:mainWrap(flex min-h-screen lg:pl-64)> header(64 glass)> tags 条 > main -->
|
|
<div id="mainWrap" class="flex min-h-screen flex-col lg:pl-64">
|
|
<AppHeader />
|
|
<TagsBar />
|
|
<main class="flex-1 p-4 md:p-6 lg:p-8">
|
|
<!-- Issue#2 keep-alive 资产:include=cachedNames(路由名=组件名);B2 实装页起各视图 defineOptions({name:路由名}) -->
|
|
<router-view v-slot="{ Component }">
|
|
<keep-alive :include="tabs.cachedNames">
|
|
<component :is="Component" />
|
|
</keep-alive>
|
|
</router-view>
|
|
</main>
|
|
</div>
|
|
<AppSidebar />
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { watch } from 'vue'
|
|
import { useRoute } from 'vue-router'
|
|
import AppHeader from './AppHeader.vue'
|
|
import AppSidebar from './AppSidebar.vue'
|
|
import TagsBar from '@/components/TagsBar.vue'
|
|
import { useTabsStore } from '@/stores/tabs'
|
|
|
|
const route = useRoute()
|
|
const tabs = useTabsStore()
|
|
|
|
// Issue#2 语义:路由到达即登记 tab(fullPath 身份去重,标题随参数刷新)
|
|
watch(() => route.fullPath, () => tabs.addTab(route), { immediate: true })
|
|
</script>
|
|
|