比如有個view元素如下
<view style="height:100px;width:100%;background:black;" res="topbox"></view>
可以這樣擷取
getRefs(){
let that = this
return new Promise((resolve,reject)=>{
resolve(that.$refs)
})
}
that.getRefs().then(res=>{
that.top_height = res.topbox.$el.offsetHeight
})
this.$refs.topbox.offsetHeight