<el-table
:data="userData"
:max-height="maxheight"
@selection-change="handleSelectionChange"
>
首先为其标签增加max-height属性,vue2在date里定义maxheight:0,随后:
mounted() {
this.$nextTick(()=>{
this.maxheight=window.innerHeight-300;
})
},
在mounted生命周期里为其固定高度,这个时候el-table就有了滚动条!