vue-router Uncaught (in promise) 报错问题
2020-06-07 05:29
344 查看
在vue项目中,每次登录都会出现一个Uncaught (in promise)错误,前边看着没啥大问题也是在项目初期搭建项目,就没管它,现在项目框架搭建好了,对这个bug已经忍到极限,可以动手怼它了。今天看到一篇文章上边写到这个bug是在vue-router版本3.1.0及以上之后才会出现的.
这是因为在vue-router更新到3.1.0版本之后,push和replace会返回一个promise,导致我们写的时候没有捕获这个异常。有兴趣的同学可以到vue-router更新日志里看看
在登录跳转的时候可以添加一个方法捕获,解决了这个报错
[code]this.$router.push({name: 'home'}, () => {})
相关文章推荐
- vue router Uncaught (in promise)
- VUE 报这个错,在浏览器的 console 中报 uncaught (in promise)
- IE报vuex requires a Promise polyfill in this browser问题解决
- 解决Chrome浏览器无法自动播放音频视频的问题,Uncaught (in promise) DOMException
- Vue-cli 在IE下[vuex] vuex requires a Promise polyfill in this browser.问题
- IE报vuex requires a Promise polyfill in this browser问题解决
- 【vuex】【vue】【兼容】IE报vuex requires a Promise polyfill in this browser问题解决
- vue.js之路(5)——解决vuex requires a Promise polyfill in this browser问题
- Uncaught (in promise) TypeError: Cannot read property '$router' of undefined
- Error: [vuex] vuex requires a Promise polyfill in this browser. 与 babel-polyfill 的问题
- Vue. 之 报错 Uncaught (in promise)
- IE浏览器报Promise未定义的错误、解决vuex requires a Promise polyfill in this browser问题
- 前端请求外域接口的时候遇到的问题Uncaught SyntaxError: Unexpected token : / Uncaught (in promise)
- vue使用技巧:Promise + async + await 解决组件间串行编程问题
- ionic3+angular4中给DOM添加监听事件后报错:Uncaught (in promise): TypeError: Cannot read property 'addEventListen
- angular4.0 ERROR Error: Uncaught (in promise): Error: No provider for AuthGuard! Error: No provider
- Uncaught (in promise) NotSupportedError: The element has no supported sources.微信小程序音频报错
- Uncaught (in promise)
- vue-router重定向 不刷新问题
- 最近碰到了关于vue-router传值的问题