html
<router-view v-slot="{ Component }">
? ? ? <transition :name="setTransitionName" mode="out-in">
? ? ? ? <keep-alive :include="keepAliveNameList">
? ? ? ? ? <component :is="Component" :key="refreshRouterViewKey" class="w100" :style="{ minHeight }" />
? ? ? ? </keep-alive>
? ? ? </transition>
? ? </router-view>
1.ts setup 寫法
1.安裝插件
npm install unplugin-vue-define-options -D
2.vite.config.ts配置
import DefineOptions from 'unplugin-vue-define-options/vite';
export default defineConfig({ plugins: [vue(), DefineOptions()],});
3.頁面寫法
defineOptions({
? name: 'brandCenterBrandCollegeNews'
});
2.ts寫法
export default { name: "TButton",};
備注:
1.name名稱必須與路由name一致且唯一
2.頁面緩存好像只支持二級,二級以上的數(shù)組要轉(zhuǎn)成一維數(shù)組