zoukankan      html  css  js  c++  java
  • wx image 对发成错误的网络请求图片 进行错误处理 binderror

    使用 binderror 对 wx image 请求的资源 发生错误时 进行错误处理 替换原图

    直接看代码吧

        <image class='matchimg' data-imgtype='banner' src="{{item.banner_url}}" binderror="_handleError" data-errorimg="{{index}}" ></image>
          let { matchList } = this.data;
          let errorImgIndex = e.target.dataset.errorimg //获取循环的下标
          let iconType = e.target.dataset.imgtype;
          let item = matchList[errorImgIndex];
    
            item.icon_url = 'http://djq-web-public.oss-cn-hangzhou.aliyuncs.com/images/ico_default_err_game.png';
    
            item.banner_url = 'http://djq-user-pub-data.oss-cn-hangzhou.aliyuncs.com/bigeyes/154/banner.jpg';
    
          matchList[errorImgIndex] = item;
          this.setData({ matchList })

    代码没贴全  

    image 是通过 matchList 循环的 仔细看看就知道了

    解决了吗? 

  • 相关阅读:
    linux磁盘扩容脚本不重启
    编译安装redis
    编译安装nginx
    ansible常用模块
    centos7 yum安装ansible
    centos7 salt操作命令
    centos7 yum安装salt
    keep
    MySQL6
    MySQL5
  • 原文地址:https://www.cnblogs.com/lisiyang/p/10246446.html
Copyright © 2011-2022 走看看