beforeRouteLeave中弹出弹窗点确认、取消后怎么执行next()跳转
问题描述
使用的是element-ui组件库,~~~~除了用this.$confirm()可以实现,怎么做到使用el-dialog呢
相关代码
beforeRouteLeave(to,from,next) {
let to1 = '/runFuncIndex';
let to2 = '/program/runProgram';
let to3 = '/monitor/monitor';
let to4 = '/configIndex';
let to5 = '/userManage';
let to6 = '/crawl';
if (to.path === to1 || to.path === to2 || to.path === to3 || to.path === to4 || to.path === to5 || to.path === to6) {
let flag1=true,flag2=true,flag3=true,flag4=true,flag5=true,flag6=true,flag7=true,flag8=true,flag9=true;
let tcpList = getStore('tcpList','list');
let fileObj = getStore("fileObj","string")
let Gravity = fileObj.Gravity.Payload;
tcpList.some(item => {
if (item.Name === this.TCPForm.tcpName) {
flag1 = item.A == this.cpotion.A
flag2 = item.B == this.cpotion.B
flag3 = item.C == this.cpotion.C
flag4 = item.X == this.cpotion.X
flag5 = item.Y == this.cpotion.Y
flag6 = item.Z == this.cpotion.Z
}
})
flag7 = Gravity.CenterX == this.cpotion.CenterX
flag8 = Gravity.CenterY == this.cpotion.CenterY
flag9 = Gravity.CenterZ == this.cpotion.CenterZ
let flag = flag1&&flag2&&flag3&&flag4&&flag5&&flag6&&flag7&&flag8&&flag9
if (!flag) {
this.$confirm("配置未生效,请确认是否保存", "提示", {
confirmButtonText: "是",
cancelButtonText: "否",
type: "warning",
distinguishCancelAndClose: false
}).then(() => {
this.saveSet();
next();
}).catch(()=> {
next();
});
} else {
next();
}
} else {
next()
}
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论