/**
* 数据分页
* **/
const paginate=(array, pageSize)=> {
return array.reduce((result, item, index) => {
const pageIndex = Math.floor(index / pageSize);
if (!result[pageIndex]) {
result[pageIndex] = []; // 创建新页
}
result[pageIndex].push(item);
return result;
}, []);
}
<!-- <div class="scroll" ref="scrollContainer" @scroll="handleScroll"> -->
/**
* 滚动到底部执行的方法
* **/
const handleScroll = () => {
const container = scrollContainer.value;
if (container) {
const { scrollTop, clientHeight, scrollHeight } = container;
if (scrollTop + clientHeight >= scrollHeight) {
pageSize.value += 10;
if (AINum.value == 1) {
getWrongQuestionSetFn()
} else {
getStrengtheningRecordsFn()
}
}
}
};