使用若依框架,切换tagviews标签时,会发现已经打开的标签页获取缓存内容, 不会刷新。
原因是<router-view>标签使用的 keep-alive,存在缓存
将AppMain.vue文件中的 keep-alive标签注释掉即可
<template>
<section class="app-main">
<transition
name="fade-transform"
mode="out-in"
>
<!-- <keep-alive :include="cachedViews"> -->
<router-view :key="key" />
<!-- </keep-alive> -->
</transition>
</section>
</template>
<script>
export default {
name: 'AppMain',
computed: {
cachedViews() {
return this.$store.state.tagsView.cachedViews
},
key() {
console.log(this.$route);
return this.$route.path
}
}
}
</script>