Vue获取URL图片的宽高 方法1:函数类型 datadragEnd() { // 创建实例对象 var img = new Image(); // 图片地址 img.src = "http://celiang.oss-cn-hangzhou.aliyuncs.com/measurement/2022-05/19/G0JSVphpS2MItH1652924237220519.jpg"; let res = {} img.onload = function () { res = { width: img.width, height: img.height } console.log(res); //获取到图片的宽高 } 方法2:简便类型 // 图片地址 var imgURL = "http://celiang.oss-cn-hangzhou.aliyuncs.com/measurement/2022-05/19/G0JSVphpS2MItH1652924237220519.jpg"; // 创建实例对象 var img = new Image() // 图片地址 img.src = imgURL // 打印 console.log('width:'+img.width+',height:'+img.height);