Vue. 之 Element table 高度自适应

时间:2023-03-09 16:06:04
Vue. 之 Element table 高度自适应

Vue. 之 Element table 高度自适应

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

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

         <el-table
:data="tableData"
:height="tableHeight"
border
style="width: 100%">

  

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

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

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