fix: update

This commit is contained in:
gx-mac 2021-03-02 16:40:03 +08:00
parent 06a8d7f6ff
commit cb7d54be80
2 changed files with 20 additions and 4 deletions

View File

@ -487,13 +487,29 @@ var Table = function (_Component) {
if (prevScrollY && currentScrollY && prevScrollY !== currentScrollY && this.props.lazyLoad && !this.props.ignoreScrollYChange) {
this.bodyTable.scrollTop = 0;
} else if (this.props.ignoreScrollYChange && currentScrollY && prevScrollY && prevScrollY !== currentScrollY) {
var distance = this.bodyTable.scrollTop + (currentScrollY - prevScrollY);
var bodyScrollTop = this.bodyTable.scrollTop;
if (bodyScrollTop === 0) {
// 在顶部的时候,滚动条不用动
this.bodyTable.scrollTop = 0;
} else {
var distance = bodyScrollTop + currentScrollY - prevScrollY;
if (distance < 0) {
this.bodyTable.scrollTop = 0;
} else {
var _bodyTable = this.bodyTable,
scrollHeight = _bodyTable.scrollHeight,
scrollTop = _bodyTable.scrollTop;
var bottomDistance = Math.abs(scrollHeight - scrollTop - prevScrollY); // 在最底部的时候也不用滚动滚动条
if (bottomDistance < 5) {
// 有些dom计算不是十分精确设置一个值来缓冲一下
this.bodyTable.scrollTop = scrollTop + prevScrollY - currentScrollY;
} else {
this.bodyTable.scrollTop = distance;
}
}
}
}
// 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断
this.isShowScrollY();
if (this.bodyTable) {

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "2.3.15-beta.2",
"version": "2.3.15-beta.3",
"description": "Table ui component for react",
"keywords": [
"react",