使用vue创建table后,其高度自适应浏览器高度.

  在创建的 el-table 中添加:height属性,其值为一个变量(tableHeight)

1         <el-table
2                 :data="tableData"
3                 :height="tableHeight"
4                 border
5                 style="width: 100%">

  

  在script中的data() 中添加高度的定义:

  这里的200是自己根据实际需求进行定义的,此处的200是因为该table上方有个form表单,减去form表单的高度(200)

1 data() {
2             return {
3                 tableHeight: window.innerHeight  - 200,
4        }
5 }

 

相关文章:

  • 2022-12-23
  • 2021-08-29
  • 2021-12-21
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-06-08
  • 2021-12-21
  • 2022-12-23
  • 2021-11-29
相关资源
相似解决方案