赞
踩
1、发现横向滚动条很难拉动
2、进行固定列时出现了布局错乱,错乱效果如下图(参保人基础信息 列使用了fixed进行固定):
/*解决fixed引起的错位问题*/ .el-table{ overflow: auto; } /*解决横向滚动条拉不动问题*/ .el-table__header-wrapper,.el-table__body-wrapper,.el-table__footer-wrapper{ overflow: visible; } .el-table__body-wrapper{ overflow-x: visible !important; } /*这个是为了解决前面样式覆盖之后伪类带出来的竖线*/ .el-table::after{ position: relative; }
如果你修改了滚动条的样式,那么需要加上下面的样式来改变表格的边距
/deep/.el-table__fixed-right {
right: 7px!important;
}
如果你的表格中是因为加载数据后的表头不一致导致错位,那么可以使用 el-table的doLayout方法进行重新布局
<el-table ref="table" :data="tableData">
...
</el-table>
async getTableData(){
const {code, data, msg} = await getTableData({
pageNum: this.pageNum,
pageSize: this.pageSize
})
if(code != 200) return this.$message.error(msg ? msg : '获取数据失败')
this.tableData = rows ? rows : []
this.$nextTick(() => {
this.$refs.table.doLayout()
})
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。