【问题标题】:I get a syntax error when using this line of code in ie11在 ie11 中使用这行代码时出现语法错误
【发布时间】:2020-11-04 12:58:50
【问题描述】:

在 IE11 中使用这行代码时出现语法错误。

let themes = _.filter(data, (el) => {
    if (OrganizationId == 21) {
        return el.Code == 'skin-3';
    } else {
        return el.Code != 'skin-3';
    }
});

【问题讨论】:

标签: angularjs lodash internet-explorer-11


【解决方案1】:

您正在使用 IE 不支持的 arrow function 和 IE 部分支持的 let statement

我建议您使用 Babel 将代码转换为 ES5 语法。您可以将代码转换为以下代码以使其在 IE 11 中运行:

var themes = _.filter(data, function (el) {
  if (OrganizationId == 21) {
    return el.Code == 'skin-3';
  } else {
    return el.Code != 'skin-3';
  }
});
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-06
  • 1970-01-01
  • 1970-01-01
  • 2021-06-15
  • 2018-01-24
  • 1970-01-01
相关资源
最近更新 更多