fix: 改用节流函数处理大数据下的滚动
This commit is contained in:
parent
3477d84a19
commit
e44506dada
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {debounce} from './util';
|
import {debounce, throttle} from './util';
|
||||||
import CONFIG from './config';
|
import CONFIG from './config';
|
||||||
|
|
||||||
export default class InfiniteScroll extends Component {
|
export default class InfiniteScroll extends Component {
|
||||||
|
@ -163,12 +163,12 @@ export default class InfiniteScroll extends Component {
|
||||||
this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : CONFIG.defaultRowsInView;
|
this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : CONFIG.defaultRowsInView;
|
||||||
scrollEl.addEventListener(
|
scrollEl.addEventListener(
|
||||||
'scroll',
|
'scroll',
|
||||||
debounce(this.scrollListener, (debounceDuration || 150)),
|
throttle(this.scrollListener, (debounceDuration || 150)),
|
||||||
this.options ? this.options : this.props.useCapture
|
this.options ? this.options : this.props.useCapture
|
||||||
);
|
);
|
||||||
scrollEl.addEventListener(
|
scrollEl.addEventListener(
|
||||||
'resize',
|
'resize',
|
||||||
debounce(this.scrollListener, (debounceDuration || 150)),
|
throttle(this.scrollListener, (debounceDuration || 150)),
|
||||||
this.options ? this.options : this.props.useCapture
|
this.options ? this.options : this.props.useCapture
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue