Last active
June 19, 2023 05:51
-
-
Save sunzsh/a2b632d438ea819f8224928a5efbec2d to your computer and use it in GitHub Desktop.
带分页打印表头的el-table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { Table } from 'element-ui'; | |
export default { | |
extends: Table, | |
mounted() { | |
this.$nextTick(function () { | |
let thead = this.$el.querySelector('.el-table__header-wrapper thead'); | |
let theadNew = thead.cloneNode(true); | |
this.$el.querySelector('.el-table__body-wrapper table').appendChild(theadNew); | |
}) | |
}, | |
} | |
</script> | |
<style scoped> | |
.el-table >>> .el-table__body-wrapper thead { | |
display: none; | |
} | |
@media print { | |
.el-table >>> .el-table__header-wrapper { | |
display: none; | |
} | |
.el-table >>> .el-table__body-wrapper thead { | |
display: table-header-group; | |
} | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment