fix: 懒加载时修改table的scrollTop

This commit is contained in:
gx 2021-02-03 14:02:00 +08:00
parent 27c08b3f0d
commit 69d6a2216b
6 changed files with 3468 additions and 2797 deletions

File diff suppressed because one or more lines are too long

4
dist/demo.css vendored
View File

@ -452,8 +452,8 @@
color: rgb(33, 33, 33); color: rgb(33, 33, 33);
background-clip: padding-box; background-clip: padding-box;
-webkit-user-select: none; -webkit-user-select: none;
/* /*
Introduced in IE 10. Introduced in IE 10.
*/ */
-ms-user-select: none; -ms-user-select: none;
user-select: none; } user-select: none; }

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

6251
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

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