1、keep-alive
方法1:绑定include属性
APP.vue
<template>
<div id="app">
<keep-alive :include="includeStr">
<router-view></router-view>
</keep-alive>
</div>
</template>
<script>
export default{
data(){
return{
//多个页面keep-alive
includes: [
"publishrecruit", //必须为组件文件的name
"Home",
"PositionDetail"
]
}
},
computed: {
includeStr() {
return this.includes.join(",");
}
}
}
</script>
方法2:在router文件设置
APP.vue
<template>
<div