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;
          }
        }
  • 相关阅读:
    java_JDBC(3)
    java_JDBC(2)
    java_JDBC(1)
    seq语句随笔
    bzoj3159: 决战
    bzoj3905: Square
    bzoj3864: Hero meet devil
    有上下界的网络流问题
    uva12538
    bzoj3280: 小R的烦恼
  • 原文地址:https://www.cnblogs.com/godok/p/10109462.html
Copyright © 2011-2022 走看看