1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
const isSize = new Promise(function(resolve, reject) {
let width = 800;
let height = 800;
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(
() => {
let _URL = window.URL || window.webkitURL;
self.form.imageLogo = _URL.createObjectURL(file);
return file;
},
() => {
this.$message.error("上传的icon必须是小于或等于800*800!");
return Promise.reject();
}
);
|