zoukankan      html  css  js  c++  java
  • vue iview Select bug,在低版本浏览器中报错

    iview是个好东西,今天第一次试用,用来做了一个app,但是在安卓5.1各种报错啊,头痛的是不知道具体哪行代码错了,总是报错undefined is not a function。

    倒腾了半天,原来是iview的select中用了Array.find、array.findIndex方法。原来浏览器版本低了,不兼容这些JavaScript特性。果断的给打上补丁就好了

    if(typeof Array.includes == 'undefined'){
          Array.prototype.includes = function(obj){
            return this.indexOf(obj) >=0
          }
        }
    
        if(typeof Array.findIndex == 'undefined'){
          Array.prototype.findIndex = function(obj){
            for(var i in this){
              if(this[i] == obj){
                return i;
              }
            }
            return -1
          }
        }
        if(typeof Array.find == 'undefined'){
          Array.prototype.find = function(fn){
            for(var i in this){
              if(fn(this[i],i,this)== true){
                return this[i];
              }
            }
            return undefined;
          }
        }
  • 相关阅读:
    C# Dev PropertyGrid
    C# PropertyGrid控件应用心得
    FileWriter不覆盖
    FileWriter
    java试题
    Java线程池
    java自带线程池和队列详细讲解
    HashMap练习题
    Map集合
    java指定
  • 原文地址:https://www.cnblogs.com/godok/p/10109462.html
Copyright © 2011-2022 走看看