@beisen/ethos
Version:
beisencloud pc react components
22 lines (16 loc) • 535 B
JavaScript
;
function slice(data, props) {
if (!props.virtualRendering) {
return data;
}
//wuzhe----保证显示数据的条数,解决在windows下滚到最下面数据就被截没了的问题
var startIdx = props.startIndex + 1;
if (data.length - props.renderCount > 0 && startIdx > data.length - props.renderCount) {
startIdx = data.length - props.renderCount;
}
if (startIdx > 0) {
startIdx = startIdx - 1;
}
return data.slice(startIdx, startIdx + props.renderCount);
}
module.exports = slice;