rowsInview向下取整
This commit is contained in:
parent
fa02005141
commit
7b8f68df48
|
@ -49,7 +49,7 @@ function bigData(Table) {
|
||||||
var rowHeight = _this2.props.height ? _this2.props.height : defaultHeight;
|
var rowHeight = _this2.props.height ? _this2.props.height : defaultHeight;
|
||||||
//默认显示25条,rowsInView根据定高算的。在非固定高下,这个只是一个大概的值。
|
//默认显示25条,rowsInView根据定高算的。在非固定高下,这个只是一个大概的值。
|
||||||
var scrollY = _this2.props.scroll.y ? parseInt(_this2.props.scroll.y) : 0;
|
var scrollY = _this2.props.scroll.y ? parseInt(_this2.props.scroll.y) : 0;
|
||||||
_this2.rowsInView = scrollY ? Math.ceil(scrollY / rowHeight) : 20;
|
_this2.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : 20;
|
||||||
_this2.currentIndex = 0;
|
_this2.currentIndex = 0;
|
||||||
_this2.loadCount = props.loadBuffer ? _this2.rowsInView + props.loadBuffer * 2 : 26; //一次加载多少数据
|
_this2.loadCount = props.loadBuffer ? _this2.rowsInView + props.loadBuffer * 2 : 26; //一次加载多少数据
|
||||||
_this2.cachedRowHeight = []; //缓存每行的高度
|
_this2.cachedRowHeight = []; //缓存每行的高度
|
||||||
|
@ -76,7 +76,7 @@ function bigData(Table) {
|
||||||
if (nextProps.scroll.y !== props.scroll.y) {
|
if (nextProps.scroll.y !== props.scroll.y) {
|
||||||
var rowHeight = nextProps.height ? nextProps.height : defaultHeight;
|
var rowHeight = nextProps.height ? nextProps.height : defaultHeight;
|
||||||
var scrollY = nextProps.scroll.y ? parseInt(nextProps.scroll.y) : 0;
|
var scrollY = nextProps.scroll.y ? parseInt(nextProps.scroll.y) : 0;
|
||||||
_this.rowsInView = scrollY ? Math.ceil(scrollY / rowHeight) : 20;
|
_this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : 20;
|
||||||
_this.loadCount = props.loadBuffer ? _this.rowsInView + props.loadBuffer * 2 : 26; //一次加载多少数据
|
_this.loadCount = props.loadBuffer ? _this.rowsInView + props.loadBuffer * 2 : 26; //一次加载多少数据
|
||||||
_this.currentIndex = 0;
|
_this.currentIndex = 0;
|
||||||
_this.startIndex = _this.currentIndex; //数据开始位置
|
_this.startIndex = _this.currentIndex; //数据开始位置
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "bee-table",
|
"name": "bee-table",
|
||||||
"version": "1.6.40",
|
"version": "1.6.41.beta.0",
|
||||||
"description": "Table ui component for react",
|
"description": "Table ui component for react",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default function bigData(Table) {
|
||||||
const rowHeight = this.props.height ? this.props.height : defaultHeight;
|
const rowHeight = this.props.height ? this.props.height : defaultHeight;
|
||||||
//默认显示25条,rowsInView根据定高算的。在非固定高下,这个只是一个大概的值。
|
//默认显示25条,rowsInView根据定高算的。在非固定高下,这个只是一个大概的值。
|
||||||
const scrollY = this.props.scroll.y ? parseInt(this.props.scroll.y) : 0;
|
const scrollY = this.props.scroll.y ? parseInt(this.props.scroll.y) : 0;
|
||||||
this.rowsInView = scrollY ? Math.ceil(scrollY / rowHeight) : 20;
|
this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : 20;
|
||||||
this.currentIndex = 0;
|
this.currentIndex = 0;
|
||||||
this.loadCount = props.loadBuffer
|
this.loadCount = props.loadBuffer
|
||||||
? this.rowsInView + props.loadBuffer * 2
|
? this.rowsInView + props.loadBuffer * 2
|
||||||
|
@ -50,7 +50,7 @@ export default function bigData(Table) {
|
||||||
if (nextProps.scroll.y !== props.scroll.y) {
|
if (nextProps.scroll.y !== props.scroll.y) {
|
||||||
const rowHeight = nextProps.height ? nextProps.height : defaultHeight;
|
const rowHeight = nextProps.height ? nextProps.height : defaultHeight;
|
||||||
const scrollY = nextProps.scroll.y ? parseInt(nextProps.scroll.y) : 0;
|
const scrollY = nextProps.scroll.y ? parseInt(nextProps.scroll.y) : 0;
|
||||||
_this.rowsInView = scrollY ? Math.ceil(scrollY / rowHeight) : 20;
|
_this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : 20;
|
||||||
_this.loadCount = props.loadBuffer
|
_this.loadCount = props.loadBuffer
|
||||||
? _this.rowsInView + props.loadBuffer * 2
|
? _this.rowsInView + props.loadBuffer * 2
|
||||||
: 26; //一次加载多少数据
|
: 26; //一次加载多少数据
|
||||||
|
|
Loading…
Reference in New Issue