(1)在main.vue页面
<keep-alive>
<router-view v-if="$route.meta.keepAlive"></router-view>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive"></router-view>
(2)在router.js文件中给查询页面定义meta:{.....}
{
path: "/",
name: "routerName.outsourcing",
component: Main,
children: [{
path: "/subcontractingRequisition/query",
name: "routerName.outsourcingQuery",
component: outsourcingQuery,
meta: {
keepAlive: true,
active: true
}
},
{
path: "/subcontractingRequisition/detail",
name: "routerName.outsourcingDetail",
component: outsourcingDetail
}
]
}
(3)vue文件,
deactived钩子函数中是为了解决从查询页进入详情页,table的show-overflow-tooltip的提示信息不消失依旧悬浮在页面上的问题
1.原因:使用tooltip,鼠标划入触发,快速切换其他页面,在当前页鼠标位置获取不到,导致悬停出现在其他位置
2.引发操作:触发tooltip,快速切换页面,原先触发的tooltip并未被销毁,且未被display:none导致,未获取到位置,就定位到左上角,
上述问题页面缓存才会出现