let arr = [1, br, 2, 3, 4, 5, 6, 7, 8, 9];
let nextArr = [];
function next () {
let n = 0;
let m = 3;
nextArr = arr.slice(n,m)
};
only the previous page, the front end of the next page can still be done;
above is the idea, the specific optimization needs to be manually operated by yourself
divide the data by yourself?
offset + limit version:
const offset = this.offset >> 0;
const limit = this.limit >> 0 || 10;
const list = this.list.slice(offset, offset + limit);
page + limit version:
const page = this.page >> 0 || 1;
const limit = this.limit >> 0 || 10;
const list = this.list.slice((page - 1) * limit, (page - 1) * limit + limit);
Let the background change O ( _ ) O
although this is not recommended, but if the front end is solved, you can determine the current number of pages and the number of pages per page by setting variables, modify the current number of pages when you click on the previous page or the next page, and then take out the corresponding part of the content in the for loop.
set a page
(page number) to intercept a segment of the total data (assuming an array) each time you click on paging. The format of the data amount is as follows:
Front-end processing: array interception;
background processing: background paging returns, front-end iterative requests