vue 监听页面退出,弹出确认退出提示
data () { return { // 退出确认 backConfirm: true } }, // 导航离开该组件的对应路由时调用 beforeRouteLeave (to, from, next) { if (this.backConfirm) { mui.confirm('数据未进行保存将会丢失,确认退出本页面吗?', '提示', ['否', '是'], function (e) { if (e.index == 1) { next(true); } }) } }
嘴角上扬,记得微笑

浙公网安备 33010602011771号