1、从vue-element-admin复制文件到对应位置
vue-element-admin\src\layout\components\TagsView 文件夹
vue-element-admin\src\store\modules\tagsView.js
vue-element-admin\src\views\redirect 文件夹
2、替换vue-admin-template\src\layout\components\AppMain.vue
复制以下代码直接替换AppMain.vue
<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() {
return this.$route.fullPath
}
}
}
</script>
<style lang="scss" scoped>
.app-main {
/* 50= navbar 50 */
min-height: calc(100vh - 50px);
width: 100%;
position
02-26
5224
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)