使用場景:
一張圖檔寬固定,高自适應,但是又需要用到圖檔的高度
原理:
img的load事件
methods: {
getImgH() {
// 圖檔加載完的時候重新擷取height
console.log('img height = ', this.$refs.targetImg.clientHeight)
},
},
如果對您有幫助記得幫我點贊呦!
一張圖檔寬固定,高自适應,但是又需要用到圖檔的高度
img的load事件
methods: {
getImgH() {
// 圖檔加載完的時候重新擷取height
console.log('img height = ', this.$refs.targetImg.clientHeight)
},
},
如果對您有幫助記得幫我點贊呦!