一块区域 上面一个div 下面一个div,上面div的高度不固定,下面div的高度为100%-上面div的高度
上面div
<div class="something" ref="header">
{{contentData.F_ReleaseTime}}
</div>
下面div
<div class="scrollBox" :style="{'height':scrollHeight}">
<div class="content">
<div v-html="contentData.F_NewsContent"></div>
</div>
</div>
watch:{
contentData:{
handler(){
this.$nextTick(()=>{
const headerHeight = this.$refs.header.offsetHeight
this.scrollHeight = `calc(100% - ${headerHeight}px)`
})
},
immediate:true
}
},
最开始是在computed里面直接写的 没有生效