antd 上传图片获取宽高

时间:2021-02-01 21:48:28   收藏:0   阅读:221
    handleBeforeUpload (file, fileList) {
      return new Promise(async (resolve, reject) => {
        const imageReg = /\.(gif|jpg|jpeg|png|webp|GIF|JPG|JPEG|PNG|WEBP)$/
        this.getFileWidthAndHeight(file)
        console.log(‘handleBeforeUpload...‘, this.params, file)
        if (imageReg.test(file.name)) {
          return this.GetUploadSinature(this.params).then(() => resolve())
        }
        const errText = ‘请选择图片上传‘
        this.$message.error(errText)
        // eslint-disable-next-line prefer-promise-reject-errors
        reject()
      })
    },

 

原文:https://www.cnblogs.com/dhjy123/p/14358879.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!