需求是页面跳转时弹窗却仍是否跳转,用的beforeRouteLeave开发
原因:原因
vue是因为closeOnHashChange属性默认为true
代码
this.$confirm("xxxxxxxxxxxxxxx", "退出该页面", {
type: "warning",
closeOnHashChange: false
})
.then(() => {
next();
})
.catch((e) => {
next(false);
});
还搜到一些其他解决办法
1.hash模式改成history
2.加一个定时器