fix: 传入不同的scroll.y时,重置scrollTop

This commit is contained in:
gx2025f 2021-01-11 18:02:44 +08:00
parent 6e87593017
commit f5f381c3f1
1 changed files with 6 additions and 1 deletions

View File

@ -270,7 +270,12 @@ class Table extends Component {
// if (prevProps.data.length === 0 || this.props.data.length === 0 ) {
// this.resetScrollX();
// }
// 当手动设置的scroll.y发生变化时滚动条回到顶部
const prevScrollY = prevProps.scroll.y
const currentScrollY = this.props.scroll.y
if (prevScrollY && currentScrollY && (prevScrollY !== currentScrollY)) {
this.bodyTable.scrollTop = 0
}
// 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断
this.isShowScrollY();
}