【发布时间】:2019-08-13 08:39:40
【问题描述】:
我正在将我的反应代码转换为打字稿并使用 axios 进行网络调用。 在 IE11 中运行时出现错误“未定义承诺”
我知道我需要使用 polyfill,但是如何使用?我没有使用 Babel 和 Webpack。
我使用了 babel-polyfill.js,错误消失了,但我得到了这个错误
未捕获的 Sys.ParameterCountException:Sys.ParameterCountException:参数计数不匹配。
知道我该怎么做吗?
tsconfig.json
{
"compilerOptions": {
"module": "UMD",
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"jsx": "react",
"lib": ["DOM","ES6","DOM.Iterable","ScriptHost"],
"typeRoots": []
},
"include": [
"*.tsx"
],
"exclude": [
"node_modules"
]
}
abc.tsx
import axios = require('../../Scripts/axios');
import * as React from 'react';
import * as ReactDOM from 'react-dom';
class abc extends React.Component<Props, state> {
function renderabc(res){
ReactDOM.render(
<abc resources={res}/>,
document.getElementById('abc_React')
);
}
export abc;
预期结果:axios 可在 IE11 上运行
【问题讨论】:
标签: reactjs typescript axios internet-explorer-11