标签:err tar 自定义 das nbsp -- 视频 asd promise
自定义图片宽高比例限制
checkImageWH(file) { let self = this; return new Promise(function (resolve, reject) { let filereader = new FileReader(); filereader.onload = e => { let src = e.target.result; const image = new Image(); image.onload = function () { let res = (image.width/image.height).toFixed(2) let r = res > 0.7 && res < 1.3 if (!r) { self.$message.error(‘视频图片 【尺寸比例】宽:高=1:(0.7-1.3)‘) reject() } else { resolve() } }; image.onerror = reject; image.src = src; }; filereader.readAsDataURL(file); }); }
Ant Design of Vue —— Upload组件 -- beforeUpload(图片宽高限制)
标签:err tar 自定义 das nbsp -- 视频 asd promise
原文地址:https://www.cnblogs.com/duoer/p/12845970.html