This commit is contained in:
parent
b2017909ae
commit
12f4dbf798
|
@ -37,7 +37,7 @@ const columns = [
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ id: "123", title: "性别", dataIndex: "b", key: "b", width: 60},
|
{ id: "123", title: "性别", dataIndex: "b", key: "b", width: 80},
|
||||||
{ title: "年龄", dataIndex: "c", key: "c", width: 200 },
|
{ title: "年龄", dataIndex: "c", key: "c", width: 200 },
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
|
@ -65,7 +65,7 @@ const columns = [
|
||||||
const data = [ ...new Array(10000) ].map((e, i) => {
|
const data = [ ...new Array(10000) ].map((e, i) => {
|
||||||
const rs = { a: i + 'a', b: i + 'b', c: i + 'c', d: i + 'd', key: i };
|
const rs = { a: i + 'a', b: i + 'b', c: i + 'c', d: i + 'd', key: i };
|
||||||
if(i%3==0){
|
if(i%3==0){
|
||||||
rs.b = '我的性别lalallalalal我的性别lalallalalal我的性别lalallalalal:女';
|
rs.b = '我的性别你猜猜不定高度测试测试ing:女';
|
||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
})
|
})
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -74,16 +74,22 @@ export default function bigData(Table) {
|
||||||
const {data,height} = this.props;
|
const {data,height} = this.props;
|
||||||
const rowHeight = height?height:defaultHeight;
|
const rowHeight = height?height:defaultHeight;
|
||||||
const {rowsInView} = this;
|
const {rowsInView} = this;
|
||||||
const {currentIndex} = this.state;
|
const {currentIndex = 0} = this.state;
|
||||||
|
// let index = currentIndex;
|
||||||
let index = 0;
|
let index = 0;
|
||||||
let temp = scrollTop;
|
// let temp = scrollTop - this.lastScrollTop;
|
||||||
|
let temp = scrollTop ;
|
||||||
|
// let lastScrollTop = scrollTop;
|
||||||
|
|
||||||
while (temp > 0) {
|
while (temp > 0) {
|
||||||
temp -= this.cachedRowHeight[index] || rowHeight
|
temp -= this.cachedRowHeight[index] || rowHeight
|
||||||
if(temp > 0){
|
if(temp > 0){
|
||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//记录上一次滚动的位置,作为缓存用
|
||||||
|
// this.lastScrollTop = lastScrollTop + temp;
|
||||||
|
|
||||||
// offset last row
|
// offset last row
|
||||||
// index -= 1
|
// index -= 1
|
||||||
console.log(index);
|
console.log(index);
|
||||||
|
|
Loading…
Reference in New Issue