handleInputChange(e) {
const { files } = e.target;
const rawFile = files && files[0]; // 仅使用单个文件
if (!rawFile) return;
// this.$emit('change', rawFile);
console.log(rawFile);
console.log(rawFile.name);
console.log(rawFile.size);
let reader = new FileReader();
reader.readAsDataURL(rawFile);
reader.onload = function(e) {
let image = new Image();
image.src = e.target.result;
image.onload = function() {
let csize = `${this.width}*${this.height}`;
console.log(`图像尺寸:${csize}`);
};
};
this.beforeRead(rawFile).then(file => {
console.log("==========compressedFile=====");
console.log(file);
console.log(file.name);
console.log(file.size);
let reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function(e) {
let image = new Image();
image.src = e.target.result;
image.onload = function() {
let csize = `${this.width}*${this.height}`;
console.log(`图像尺寸:${csize}`);
};
};
});
},