iview表格高度自适应只需要三步即可
1、需要增加到table表格里的 :height="tableHeight" ref="table"
<Table :columns="columns" :data="list" :height="tableHeight" ref="table"></Table>
2、在return 定义一个默认高度
return { tableHeight: 150 }
3、在mounted中重新赋值 this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160(可根据页面调整),window.innerHeight是浏览器的可用高度,this.$refs.table.$el.offsetTop是表格距离浏览器可用高度顶部的距离
mounted() { this.tableHeight = window.innerHeight - this.$refs.table.$el.offsetTop - 160 }
博主的文章或程序如果给您带来了价值,感谢您打赏一二

微信扫码支付

支付宝扫码支付