代码之家  ›  专栏  ›  技术社区  ›  Himanshu sharma

我的vue应用程序在IE中抛出错误“Object不支持属性或方法”“contains”“”

  •  0
  • Himanshu sharma  · 技术社区  · 6 年前

    enter image description here

    enter image description here

    我试着把这样的东西加进去供应商.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

    1 回复  |  直到 6 年前
        1
  •  2
  •   frontendzzzguy    5 年前

    安装 babel-polyfill 作为一个npm包导入到主js文件的顶部。例如。 import 'babel-polyfill' require('babel-polyfill')