mounted(){
if (window.performance.navigation.type == 1) {
console.log("页面被刷新!")
}else{
console.log("首次被加载!")
}
}
//还有一种方式就是通过检测路由的变化来判断是否页面被刷新
router.beforeEach((to,from,next)=>{
if (from.path === '/' && from.matched && from.matched.length === 0) {
isFirstEnter = true; // 记录路由是否为刷新
}
next();
})