console
const count = 100000;
function pageRender(total, pageIndex, size) {
setTimeout(() => {
for (let i = 0; i < size; i++) {
const el = document.createElement("div");
el.style.background = "#ccc";
el.innerText = `第${(pageIndex-1) * size + i}个`;
document.body.appendChild(el);
}
if(pageIndex < total){
pageRender(total, pageIndex+1, size);
}
}, 0);
}
function append() {
const size = 1000;
const total = Math.ceil(count / size);
pageRender(total, 1, size);
}
<button onclick="append()">change</button>