我的 Vue 应用程序在 IE 中抛出错误 `Object doesn't support 属性 or method 'contains'`
My vue application throwing error `Object doesn't support property or method 'contains'` in IE
我遇到了这个问题
我试图在 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
安装 babel-polyfill
作为 npm 包并将其导入到主 js 文件的顶部。例如。 import 'babel-polyfill'
或 require('babel-polyfill')
我遇到了这个问题
我试图在 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
安装 babel-polyfill
作为 npm 包并将其导入到主 js 文件的顶部。例如。 import 'babel-polyfill'
或 require('babel-polyfill')