今天在制作一个表体组件的时候需要用到一个合计效果,把show-summary,放上去的时候出现了一个效果炸裂的错误,找了半天之后决定自己解决,以下是解决方案。
错误展示1:
下方的合计行直接挡住了序号10的位置,如果没有这种错误请跳过看2。
解决方法:
在数据更新的最后一行,或者:summary-method对应的方法的第一行加上这段代码
this.$nextTick(() => {
this.$refs.invoiceTable.doLayout();// invoiceTable替换为你的el-table设置的ref值
})
加上后又出现了新的问题
滚动条遮挡了一部分位置
错误展示2:
解决方法:
.el-table__fixed {
height: calc(100% + 17px) !important;
.el-table__fixed-footer-wrapper {
bottom: 17px;
}
}
.el-table__fixed-right {
height: calc(100% + 17px) !important;
.el-table__fixed-footer-wrapper {
bottom: 17px;
}
}
如果无效请检查seyle标签上有没有scoped,有的话去掉即可
或者你不想去掉,可以在前面添加 /deep/ 或者加上 ::v-deep
deep示例:
::v-deep .el-table__fixed {
height: calc(100% + 17px) !important;
.el-table__fixed-footer-wrapper {
bottom: 17px;
}
}
::v-deep .el-table__fixed-right {
height: calc(100% + 17px) !important;
.el-table__fixed-footer-wrapper {
bottom: 17px;
}
}
解决后效果:
结束,element真的是越踩越多坑