之前按需求做了el-table的区域块,td太多超出区域了,使用了style里的height,找了老半天都没处理后来发现是在el-table加入以下代码就可以出现滚动区域
<el-table :height="tabheight" ></table>
data(){
return {
tabheight:'200px'
}
}
注style加入的无效,只能这样了,以下是动态修改滚动区域高度的方法
methods:{
// 表格滚动高度自设配
scheduleHeight(){
this.tabheight= window.innerHeight - 372
}
}
mounted(){
this.scheduleHeight()
window.addEventListener("resize", this.scheduleHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.scheduleHeight)
}