缓存页面数据
如果有多个页面需要缓存
<keep-alive :include="['apporder','othername']">
<router-view></router-view>
</keep-alive>
除了跳这两页面,跳其他页面清掉不需要的数据
// 路由离开时
beforeRouteLeave (to, from, next) {
// // 导航离开该组件的对应路由时调用
if (to.path != '/appointmentNumber/list' && to.path != '/appointmentNumber/mealList') {
localStorage.removeItem('formInfo')
}
next()
},