Skip to content

Commit

Permalink
Merge pull request #191 from realyuyanan/develop
Browse files Browse the repository at this point in the history
fix(table): 异步拉取数据 maxHeight 不生效的问题 #134
  • Loading branch information
chaishi authored Jan 7, 2022
2 parents 6ff24f6 + b6e4217 commit 164635f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/table/base-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ export default mixins(getConfigReceiverMixins<Vue, TableConfig>('table')).extend
emitEvent(this, scrollListenerName, scrollParams);
}
},
checkMaxHeight() {
const { maxHeight } = this;
if (maxHeight && (this.$refs.tableContent as HTMLElement).clientHeight > maxHeight) {
this.useFixedHeader = true;
}
},
},
render() {
const {
Expand Down Expand Up @@ -356,6 +362,9 @@ export default mixins(getConfigReceiverMixins<Vue, TableConfig>('table')).extend
</div>
);
},
updated() {
this.checkMaxHeight();
},

mounted() {
if (this.hasFixedColumns) {
Expand All @@ -379,9 +388,6 @@ export default mixins(getConfigReceiverMixins<Vue, TableConfig>('table')).extend
document.body.appendChild(scrollDiv);
this.scrollBarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
const { maxHeight } = this;
if (maxHeight && (this.$refs.tableContent as HTMLElement).clientHeight > maxHeight) {
this.useFixedHeader = true;
}
this.checkMaxHeight();
},
});

0 comments on commit 164635f

Please sign in to comment.