方法一:(在当前页面写)
if (location.href.indexOf("#caseDsc") == -1) {
location.href = location.href + "#caseDsc";
this.reload();
}
方法二:(在home页面写)
通过监听路由跳转,触发刷新方法
export default {
inject: ["reload"],
// 监听路由变化
watch: {
$route: {
handler (to, from) {
if (to.path != from.path) {
// 处理路由
this.routeHandle(to)
//赋值给Cook
var MenuId = to.meta.MenuId
//存储菜单Id
localStorage.setItem("MenuIds", MenuId)
this.breadcrumbList = this.breadcrumbObj[to.meta.title]
this.reload()
}
},
},
},
}
ps(刷新方法):vue 当前页面刷新 provide + inject-CSDN博客