1.app.vue
<keep-alive>
<router-view v-if="$route.path == '/theme/classMeeting'"></router-view>
</keep-alive>
<router-view v-if="$route.path != '/theme/classMeeting'"></router-view>
2. 返回页面
beforeRouteLeave(to, from, next) { //保存滚动条元素div的scrollTop值
this.scrollY = document.getElementById('main').scrollTop
next()
},
activated() { //如果页面有keep-alive缓存功能,这个函数会触发
document.getElementById('main').scrollTop = this.scrollY // 设置滚动条位置
},