el-table根据浏览器动态设置高度 深藏阁楼爱情的钟 2024-03-30 12:57 12阅读 0赞 Vue+Element-UI根据浏览器大小动态设置el-table的高度. ### 效果 ### ![在这里插入图片描述][3d5692413d4841b7a5bf3ac70c5589b1.png_pic_center] ### 示例代码 ### <template> <lls-table :data="tableData" :height="tableHeight"> </llst-bale> </template> export default { data () { return { tableHeight: window.innerHeight - 340, tableData:[] } }, created () { window.addEventListener('resize', this.getTableHeight) }, destroyed () { window.removeEventListener('resize', this.getTableHeight) }, methods () { getTableHeight () { this.tableHeight = window.innerHeight - 340 }, }, } [3d5692413d4841b7a5bf3ac70c5589b1.png_pic_center]: https://image.dandelioncloud.cn/pgy_files/images/2024/03/30/ddb73a30a394475db70c097913d88a53.png
还没有评论,来说两句吧...