当我进入一个Menu 某个菜单 页面时 此页面是可以编辑的
所以需要在切换路由时候确认用户是否切换路由
所以 使用beforeRouteLeave来判断路由是否跳转
但是 我要是切换路由的话 点击取消之后 不跳转路由
但是menu 的选中效果已经选中到了我要跳转的指定菜单
这样不就不对劲了吗。
beforeRouteLeave (to, from , next) {
const answer = window.confirm('Do you really want to leave? you have unsaved changes!')
if (answer) {
next()
} else {
next(false)
}
}


推荐使用Ant
Most helpful comment
推荐使用Ant