You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
import { Message } from 'element-ui' export default function (file, width, height) { return new Promise(resolve => { let reader = new FileReader(); reader.readAsDataURL(file); reader.onload = function (e) { let txt = e.target.result; let img = document.createElement("img"); img.src = txt; img.onload = function () { if (img.width === width && img.height === height) { resolve(true) } else { Message({ message: `图片上传失败,宽高错误`, type: "warning", duration: 5000 }); resolve(false); } }; }; }) } // 1. 650 350
// 1. 650 350
// 1. 650 350
// 1. 650 350
// 1. 650 350
|