-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[vue] 切换路由时,需要保存草稿的功能,怎么实现呢? #417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
在beforeDestroy中加入check功能, 但是我要说的是, 这种方法是不靠谱的, 如果我是刷新页面呢! 具体看业务场景 |
可以用 |
用keep-alive缓存那个路由 |
beforeRouteLeave |
你这题目想说明的是,切换路由时自动或提示保存草稿功能吗? beforeRouteLeave (to, from, next) {
if(用户已经输入信息){
//出现弹窗提醒保存草稿,或者自动后台为其保存
}else{
next(true);//用户离开
}
} |
面试如果要问这种问题,等于得背API |
https://blog.csdn.net/loyd3/article/details/118188179 这个离开守卫通常用来禁止用户在还未保存修改前突然离开。该导航可以通过 next(false) 来取消。
|
[vue] 切换路由时,需要保存草稿的功能,怎么实现呢?
The text was updated successfully, but these errors were encountered: