博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
element-ui上传图片,限制图片尺寸,
阅读量:2052 次
发布时间:2019-04-28

本文共 898 字,大约阅读时间需要 2 分钟。

const isSize = new Promise(function(resolve, reject) {                let width = 60;                let height = 60;                let _URL = window.URL || window.webkitURL;                         let img = new Image();                img.onload = function() {                    debugger                    let valid = img.width >= width && img.height >= height;                    valid ? resolve() : reject();                }                img.src = _URL.createObjectURL(file);                }).then(() => {                    return file;                }, () => {                    this.$message.error('上传的icon必须是等于60*60!');                    console.log(this.imgFileList);                    this.hideUpload = false                      this.imgFileList = []  //将上传的图片清空                    return Promise.reject();                                    });                return  isSize;

转载地址:http://ekylf.baihongyu.com/

你可能感兴趣的文章
Go语言学习Part2:流程控制语句:for、if、else、switch 和 defer
查看>>
Go语言学习Part3:struct、slice和映射
查看>>
Go语言学习Part4-1:方法和接口
查看>>
Leetcode Go 《精选TOP面试题》20200628 69.x的平方根
查看>>
Leetcode C++ 剑指 Offer 09. 用两个栈实现队列
查看>>
Leetcode C++《每日一题》20200707 112. 路径总和
查看>>
云原生 第十一章 应用健康
查看>>
Leetcode C++ 《第202场周赛》
查看>>
云原生 第十二章 可观测性:监控与日志
查看>>
Leetcode C++ 《第203场周赛》
查看>>
云原生 第十三章 Kubernetes网络概念及策略控制
查看>>
《redis设计与实现》 第一部分:数据结构与对象 || 读书笔记
查看>>
《redis设计与实现》 第二部分(第9-11章):单机数据库的实现
查看>>
算法工程师 面经2019年5月
查看>>
搜索架构师 一面面经2019年6月
查看>>
稻草人手记
查看>>
第一次kaggle比赛 回顾篇
查看>>
leetcode 50. Pow(x, n)
查看>>
leetcode 130. Surrounded Regions
查看>>
【托业】【全真题库】TEST2-语法题
查看>>