use the element-ui frame of the racing lantern component, the need is to get the height of the img, printed out is Undedined, this is why?
the code is as follows:
< el-carousel arrow = "always" indicator-position = "none": height = heightNum >
<el-carousel-item v-for = "(item,index) in items" :key = "item">
<img :src = "item.bannerImgSrc" alt="" :ref = "item.name" @click = "setActiveItem(index)"/>
</el-carousel-item>
< / el-carousel >
data () {
return {
items:[
{bannerImgSrc:"static/image/icon/banner01.png",name:"a"},
{bannerImgSrc:"static/image/icon/banner02.png",name:"b"},
{bannerImgSrc:"static/image/icon/code01.png",name:"c"},
{bannerImgSrc:"static/image/icon/code02.png",name:"c"},
],
}
},
mounted () {
var y = this.$refs.b.offsetHeight;
console.log(y);
},