Skip to content
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

doclose中的settimeout恢复overflow的bug #9

Closed
acelan86 opened this issue Jan 3, 2017 · 0 comments
Closed

doclose中的settimeout恢复overflow的bug #9

acelan86 opened this issue Jan 3, 2017 · 0 comments

Comments

@acelan86
Copy link

acelan86 commented Jan 3, 2017

当关闭的时候为什么要延迟200ms恢复overflow?

我使用的时候是这个场景
在一个编辑页面,编辑页面需要配置跳转前提示是否保存修改,我在全局的beforeRouterEnter的时候设置弹出框提示,当点确定的时候执行路由跳转,这时候执行路由跳转会销毁当前的vue的实例this,因为this.modal的判断延后了200ms,所以这时候this.modal没有了,必然就无法执行恢复overflow

是我使用的姿势不对?

import MessageBox from 'components/message-box'
 
// ...

router.beforeEach((route, redirect, next) => {
  if (route.matched.some(m => m.meta.needGuard)) {
    // console.log(router.path + '需要进行权限验证')
    authInterceptor(route, redirect, next)
  } else if (redirect.matched.some(m => m.meta.needConfirm) && !route.query.ignoreConfirm) {
    MessageBox.confirm(
      '页面未保存,确定离开此页面吗?',
      '提示',
      {
        type: 'warning',
        cancelButtonText: '留在该页面',
        confirmButtonText: '确定离开'
      }
    )
    .then(() => {
      next()
    })
    .catch(() => {
      next(false)
    })
  } else {
    next()
  }
})
@acelan86 acelan86 closed this as completed Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant