<input id="file" @change="uploadImegs($event,3)" type="file" accept="image/*" />
uploadImegs(e) {
let _file = e.target.files[0];
if (_file) {
if (!/\.(jpg|jpeg|png|JPG|PNG)$/.test(e.target.value)) {
this.$Message.info("图片类型必须是,jpeg,jpg,png中的一种");
return false;
}
let reader = new FileReader();
reader.onload = e => {
var image = new Image();
image.src = e.target.result;
image.onload = function() {
let width = 0
let height = 0
console.log("宽" + this.width, "高" + this.height)
};
let data;
data = e.target.result;
this.cropperData.imgUrl = data;
};
reader.readAsDataURL(_file);
}
e.target.value = ""
}
版权声明:本文为Kino_Hs原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。