beforeAvatarUpload(file) { const isLt3M = file.size / 1024 / 1024 < 3; if (!isLt3M) { this.$message.error("上传宝贝详情图片大小不能超过 3MB!"); } let _this = this; const isSize = new Promise(function(resolve, reject) { //upload内部需要一个promise,简单的return出false并没有什么用 let width = 700; let _URL = window.URL || window.webkitURL; let img = new Image(); img.onload = function() { file.width = img.width; //获取到width放在了file属性上 file.height = img.height; //获取到height放在了file属性上 let valid = img.width &g
elementUI上传图片前判断限制图片宽高和尺寸
最新推荐文章于 2023-02-02 10:16:35 发布