beforeRouteLeave (to, from, next) { // 离开页面
if (this.editFlag === true) {
this.$confirm('页面尚未保存,确认离开吗?', '提示', {
distinguishCancelAndClose: true, // 区分取消和关闭
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'info'
}).then(() => {
next()
}).catch(action => {
// 取消按钮
})
} else {
next()
}
}