beforeAvatarUpload(file) { const isSize = new Promise(function(resolve, reject) { let width = 100; let height = 100; let _URL = window.URL || window.webkitURL; let img = new Image(); img.onload = function() { let valid = img.width >= width && img.height >= height; valid ? resolve() : reject(); } img.src = _URL.createObjectURL(file); }).then(() => { return file; }, () => { this.$message.error('上传的icon必须是等于或大于100*100!'); return Promise.reject(); }); return isSize; }