Premise: Create a database, preferably with more than 20 pieces of data in the database, so that we can realize the paging effect achieved in different situations
Paging is divided into three scenarios:
(1) Scenario 1: When the current number of pages is less than 5 or the total number of pages is less than or equal to 9, the 1-9 page button is displayed
(2) Scenario 2: When the current page is greater than or equal to 5, and the current page plus 5 is less than or equal to the total number of pages, the first 4 and last 4 pages of the current page are displayed
(3) Scenario 3: The current page number is greater than 9
Effect:
Code: Looking at the code by the number of lines, I annotated the meaning and logic of almost every sentence of the code. If you read it carefully, you will be able to understand the entire running process.
above
END