h5 vue vant插件 画图黑屏问题

vant组件上传较大图片(超过1M)时,不要立即对这张图片进行压缩操作,会造成黑屏

解决办法:等下(1秒就够)再进行操作

      <van-field v-if="reserveList.indexOf('visitorCertPath') != -1" name="visitorCertPath" label="证件照">
        <template #input>
          <van-uploader max-count="1" v-model="visitorCertPath" :after-read="afterReadCert" />
        </template>
      </van-field>

    //vant组件读取图片的回调
    afterReadCert(file) {
            clearTimeout(timerName)
            var timerName = setTimeout(function() {
        //稍等下再执行压缩操作
              this.compressPic(file)
          }, 3000)
      
    },
君不见,高堂明镜悲白发,朝如青丝暮成雪
原文地址:https://www.cnblogs.com/lzhflzjx/p/13794052.html