1、绑定动态高度 :height="tableHeight"
<el-table ref="refsTable" v-loading="loading" :data="typeList" @selection-change="handleSelectionChange" @row-click="handleEdit" :height="tableHeight">
</el-table>
2、获取当前高度
mounted(){
this.$nextTick(() =>{
// 根据浏览器高度设置初始高度
this.tableHeight= window.innerHeight - this.$refs.refsTable.$el.offsetTop - 170
// 监听浏览器高度变化,修改表格高度
window.onresize = () =>{
this.tableHeight= window.innerHeight - this.$refs.refsTable.$el.offsetTop - 170
}
if(this.heights<300){
this.tableHeight=300;
}
})
},