// 检测断网
window.addEventListener("offline", () => {
console.log("已断网");
this.messages=this.$message({
duration:2000,
message: '网络断开或网络不稳定,请检查网络',
type: 'warning'
});
setTimeout(() => {
this.messages.close();
//sessionStorage.clear("userinfos");
//sessionStorage.clear();
this.$router.push({
path: '/'
})
}, 2000);
});
window.addEventListener("online", () => {
console.log("网络已连接");
this.messages.close();
//sessionStorage.clear("userinfos");
//sessionStorage.clear();
this.$router.push({
path: '/'
})
this.reload()
});
Vue断网跳转登陆页处理
最新推荐文章于 2023-04-26 10:26:09 发布