axios IE承诺不起作用 [英] axios IE promise doesn't work
问题描述
我正在使用axios进行ajax通信。
我有IE的问题。关于Promise的IE返回错误。
IE对Promise一无所知。
I am using axios for ajax communication. I have problem with IE. IE return error about Promise. IE doesn't know anything about Promise.
我写的是react / redux但是我在普通JS中尝试过axios并且结果相同
I am writing react/redux but I tried axios in plain JS and same result
有人可以帮我吗?
我很困惑因为axios应该在IE 8上工作
我在IE 11上试过(windows 10 64bit)
Could someone help me with it? I am confused because axios should work on IE 8+ I tried on IE 11 (windows 10 64bit)
我的试用版是按原样写的例如在axios主页上
My trial is written as is in example on axios homepage
thx
推荐答案
你必须包括如果浏览器没有承诺实现,则为promise polyfill。这听起来很复杂,但确实有很好的库。
You have to include a promise polyfill if the browser has no promise implementation. This sounds complicated but there are really good libs.
axios docs提到它:
axios依赖于支持的本机ES6 Promise实现。如果您的环境不支持ES6 Promises,您可以填充。
The axios docs mention it: axios depends on a native ES6 Promise implementation to be supported. If your environment doesn't support ES6 Promises, you can polyfill.
如果您只使用JS而不进行转换或捆绑,则可以尝试 es6-promise
If you use just JS without transpiling or bundling you can try es6-promise
或者如果你使用babel,你可以其polyfill
or if you use babel you can take its polyfill
这篇关于axios IE承诺不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!