当页面搜索条件太多,屏幕分辨率由1920变为1366时,搜索模块高度发生变化,需要通过计算获取高度和表格设置高度,
代码实现
<template>
<div>
<div class="search" ref="search" id="search">
......
</div>
<div :style=" table_right3">
<el-table :data="activeTableData1" style="width:100%;"
:row-key="getRowKey" height="95%"
:header-cell-style="{'background-color':'#ebeef54a'}">
......
</el-table>
</div>
</div>
</template>
<script>
export default {
data(){
return {
elementHeight:0,
table_right3:{}
}
},
mounted() {
this.searchheight()
},
methods: {
//获取 searchheight
searchheight(){
let that = this
setTimeout(()=>{
that.elementHeight = document.getElementById('search').offsetHeight
let elementHeight = 240+that.elementHeight
that.table_right3 = {
'margin-top':'10px',
'height': `calc(96vh - ${elementHeight}px)`
}
},100)
},
}
}
</script>