在表格属性添加 ref="table", :height="tableHeight"
<Table border :columns="columns1" :data="data1" ref="table" :height="tableHeight" ></Table>
在data里面添加表格初始高度
data(){
return {
tableHeight:100,
}
}
mounted() {
/*
表格高度自适应
window.innerHeight是浏览器的可用高度 ,
this.$refs.table.$el.offsetTop是表格距离浏览器可用高度顶部的距离
减去60,因为分页要的高度
*/
this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 60
}