keep-alive嵌套缓存,组件onMounted多次执行
Version
3.2.25
Reproduction link
Steps to reproduce
npm install npm run dev keep-alive缓存列表,点击跳转详情页,onMounted钩子函数执行数次
What is expected?
执行一次
What is actually happening?
执行数次
Your key always change. You might want to use
<router-view v-slot="{ Component, route }">
<transition mode="out-in" name="fade">
<keep-alive :include="cachedViewsDeep">
<component :is="Component" :key="route.name || route.path" />
</keep-alive>
</transition>
</router-view>
Remember to use the forum or the Discord chat to ask questions!
Your key always change. You might want to use
<router-view v-slot="{ Component, route }"> <transition mode="out-in" name="fade"> <keep-alive :include="cachedViewsDeep"> <component :is="Component" :key="route.name || route.path" /> </keep-alive> </transition> </router-view>
Remember to use the forum or the Discord chat to ask questions!