本文共 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/