场景: el-table 表格 需要 input类型是 textarea 高度是自适应,第一页数据都是单行数据 不会产生滚动条,但是第二页数据是多行数据 会产生滚动条,
bug: 第一页切换到第二页 第二页滚动条无法展示
解决办法:直接修改样式 加上overflow-y:auto 样式 完美解决
javascript">this.$nextTick(() => {const table = this.$refs.tableRef.$el;const bodyWrapper = table.querySelector(".el-table__body-wrapper");if (bodyWrapper) {// 直接修改内联样式bodyWrapper.style.overflowY = "auto";}
});
或者直接使用css
::v-deep .el-table__body-wrapper {overflow-y: auto ;
}