beforeAvatarUpload(file) {
const isSize = new Promise(function (resolve, reject) {
let _URL = window.URL || window.webkitURL;
let img = new Image();
img.src = _URL.createObjectURL(file);
img.onload = function () {
console.log(img.width, img.height)
let valid = img.width / img.height === 16 / 9;
valid ? resolve() : reject();
};
}).then(() => {
return file;
}, () => {
this.$message.error("16:9");
return false;
});
const is1M = file.size / 1024 / 1024 < 1;
if (!is1M) {
this.$message.error(" 1MB!");
}
return isSize && is1M;
},
rejectfalse