Open openks opened 6 years ago
for (let i = 0; i < res.data.result.length; i++) { let result = res.data.result[i]; (function (i) { let imgUrl = that.mixinBaseUrl + '/file' + result.url // 创建对象 let img = new Image() // 改变图片的src img.src = imgUrl // 定时执行获取宽高 let check = function () { // 只要任何一方大于0 // 表示已经服务器已经返回宽高 if (img.width > 0 || img.height > 0) { that.picitems.push({ src: that.mixinBaseUrl + '/file' + result.url, thumbnail: that.mixinBaseUrl + '/file' + result.url, w: img.width, h: img.height }) console.log(img.width, img.height) clearInterval(set) img = null check = null } } let set = setInterval(check, 40) })(i) }
配合 vuepictureSwipe使用刚好
vuepictureSwipe
配合
vuepictureSwipe
使用刚好