欢迎关注前端小讴的github,阅读更多原创技术文章
框架项目用axios调用接口时,咱们经常使用:前端
接口名().then(result=>{ do sth... }).catch(()=>{ do sth... }).finally(()=>{ do sth... })
却会遇到这个问题:ios
fName(...).then(...).catch(...).finally is not a function 形成此问题的缘由为:浏览器版本过低
除了升级最新版浏览器(火狐甚至升级后还报错),解决办法以下:git
安装 promise.prototype.finally 包 npm i promise.prototype.finally
最后记得在 main.js 里引入该依赖包:github
require('promise.prototype.finally').shim();