Element UI version
2.13.1
OS/Browsers version
86.0.4240.111
Vue version
2.6.11
Reproduction Link
Steps to reproduce
。。重现链接不支持 codesandbox吗
我把重现链接粘贴到这里吧 https://codesandbox.io/s/upbeat-resonance-7h6hj
1.从首页点击 路由1 会弹出 $confirm 弹框,选择确认跳转到 路由1的页面。
2. 之后点击Home跳回首页。
3. 之后点击浏览器的 后退 按钮 ,beforeRouteLeave方法成功触发,但是 $confirm弹框一闪而逝,观察页面URL已经变化(即并没有拦截路由跳转)
What is Expected?
点击后退按钮 $confirm 弹框正常展示,并且会拦截跳转行为,选择确认方才跳转到上一条历史记录的页面。
What is actually happening?
$confirm弹框一闪而逝,观察页面URL已经变化(即并没有拦截路由跳转)
2条答案
按热度按时间hvvq6cgz1#
用setTimeout 包裹住confirm 就可以弹窗 等官方解决
外面记得 next(false)
anauzrmj2#
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.