vue3用keep-alive缓存页面了,但是每次切换tab进入页面还是会进入onMounted,导致没有缓存效果,为什么呢?

新手上路,请多包涵

vue3用keep-alive缓存页面了,但是每次切换tab进入页面还是会进入onMounted,重新加载数据,导致没有缓存住筛选状态的效果,为什么呢?我哪里写的错误吗?

image.png
vuetools
image.png
打印出来
image.png

order页面
image.png

阅读 4.2k
1 个回答

这样试试看

<router-view v-slot="{ Component }">
    <keep-alive include="orderList,userList">
        <component :is="Component" :key="$route.fullPath" />
    </keep-alive>
</router-view>
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题