<div class="file-wrapper"> <img class="file-position" src="1.jpg" alt="" ref="imgSize" @onload="imgload"> </div>
mounted(){ this.fileUrl = this.$route.query.file || '' //获取屏幕大小 let clientHeight = document.documentElement.clientHeight || document.body.clientHeight; console.log(clientHeight); this.imgload(); },
methods:{ imgload(){ let imgSize = this.$refs['imgSize'].offsetHeight; console.log(imgSize); } }
如何获取 加载的图片的高度(图片宽高未知) imgSize 获取的值和真实的不一样?
梵蒂冈之花
相关分类