【问题标题】:IE SCRIPT1028: Expected identifier, string or numberIE SCRIPT1028:预期的标识符、字符串或数字
【发布时间】:2020-09-05 05:39:30
【问题描述】:

我的项目是 react typescript 项目,我在下面的代码中遇到错误,它适用于所有浏览器但在 IE 11 中失败,我觉得它发生在 ...prop,我们如何简化此代码以在 IE 11 中工作。任何人都可以帮助我吗?

   const abc = function({prop}) => {
    const data = getData();
     return {
       ...prop,
       currentData : data,
     }
   }

【问题讨论】:

    标签: javascript reactjs internet-explorer cross-browser


    【解决方案1】:

    Arrow function expressionsrest parameterSpread syntax都是ES6语法,都不支持IE浏览器。请单击以前的链接并检查浏览器兼容性。

    您可以尝试使用Babel.js 将代码转换为 ES5 语法。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多