在JavaScript函数中使用“ array-includes”代替“ includes”来跳过IE11中的问题

时间:2019-01-25 19:17:16

标签: javascript twitter-bootstrap-3 es5-shim

我正在ASP.net中编写一个应用程序。我也在使用Bootstrap 3框架。 现在bootstrap-table.min.js使用

f(!h.includes(e))....

这会在Internet Explorer 11中引发异常,并建议使用indexOF。在Firefox和Chrome中,一切正常。

一种解决方案是修改功能并使用.array-includes代替.includes,但是要做到这一点,我需要找到一个匀称的环境。

无论如何,我都尝试使用airbnb-js-shims版本徽章。 我不明白我该如何使用此垫片。

我已经安装了airbnb-js-shims(Visual Studio 2013程序包控制台 )

npm i airbnb-js-shims

但是我收到以下消息

  npm.cmd : npm notice created a lockfile as package-lock.json. You should commit this file.
In row:1 car:4
+ npm <<<<  i airbnb-js-shims
     + CategoryInfo          : NotSpecified: (npm notice crea...mmit  this file.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 npm
   WARN
    SupportPRJ No description
npm
   WARN
    SupportoPRJ No repository field.
npm
   WARN
    SupportoPrj No license field.

命令npm i airbnb-js-shims创建了一个名为node_modules的文件夹,其中有许多子文件夹(airbnb-js-shimsarray.prototype.flat等...)

写在网站上 只需require/import airbnb-js-shims,环境就会被填充”

import 'airbnb-js-shims';

我不知道该命令应放在.js文件中还是其他任何地方?

我将此命令放在.js中,但收到语法错误的异常。

在此先感谢您的宝贵支持,对于这种环境我缺乏知识深表歉意。

0 个答案:

没有答案