Internet explorer 我的vue应用程序抛出错误“对象不';t支持属性或方法';包含';`在IE中
我有这个问题 我试图在vender.js中添加类似的内容Internet explorer 我的vue应用程序抛出错误“对象不';t支持属性或方法';包含';`在IE中,internet-explorer,vue.js,webpack,vuejs2,internet-explorer-11,Internet Explorer,Vue.js,Webpack,Vuejs2,Internet Explorer 11,我有这个问题 我试图在vender.js中添加类似的内容 if (!('contains' in String.prototype)) { String.prototype.contains = function (str, startIndex) { return -1 !== String.prototype.indexOf.call(this, str, startIndex); }; } 但它仍然不起作用。 原因可能是什么 IE 11.0.9600版
if (!('contains' in String.prototype)) {
String.prototype.contains = function (str, startIndex) {
return -1 !== String.prototype.indexOf.call(this, str, startIndex);
};
}
但它仍然不起作用。
原因可能是什么
IE 11.0.9600版安装
babel polyfill
作为npm包,并将其导入主js文件顶部。例如,import'babel polyfill'
或require('babel-polyfill')
将babel polyfill
安装为npm软件包,并将其导入主js文件顶部。例如,导入“babel polyfill”
或要求(“babel-polyfill”)
请指定您使用的IE版本。还要指定它是否在兼容模式下运行。我添加了IE版本。您是否尝试在添加contains属性之前和之后控制台日志字符串原型,然后比较它们?或者只是test:String.prototype.contains==未定义前后它看起来可能在第10行缺少一个右括号,除非这是一个屏幕截图问题安装babel polyfill
作为npm包并导入它,并在主js文件顶部写入。例如,import'babel polyfill
或require('babel-polyfill')
请指定您使用的IE版本。还要指定它是否在兼容模式下运行。我添加了IE版本。您是否尝试在添加contains属性之前和之后控制台日志字符串原型,然后比较它们?或者只是test:String.prototype.contains==未定义前后它看起来可能在第10行缺少一个右括号,除非这是一个屏幕截图问题安装babel polyfill
作为npm包并导入它,并在主js文件顶部写入。例如,import'babel polyfill
或require('babel-polyfill')