简体   繁体   中英

promise is undefined in IE11 when using axios in ReactJS

I am coverting my react code to typescript and using axios for network call. On running in IE11 i get error "Promise is not defined"

I know i need to use polyfill but how? I am not using Babel and Webpack.

I used babel-polyfill.js and error goes away but I get this ERROR

Uncaught Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch.

Any idea how could i do it?

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;

results expected: axios to work on IE11

axios文档指向 axios ,其中包含有关如何将其包含在页面中的说明。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM