用el-table 想让表格高度根据屏幕动态展示,用max-height后发现内容超过高度不展示滚动条
查阅后发现默认是隐藏,而不是滚动展示
如果想让展示,则可以用样式加上overflow-y: auto
全部代码如下
<template>
<el-table
size="small"
:data="tableData"
:max-height="tableHeight"
style="width: 100%; overflow-y: auto">
</el-table>
</template>
<script>
export default{
data(){
return{
tableHeight: 'calc(100vh - 400px)',
}
}
}
</script>