This article mainly brings you a method to implement front-end paging function based on LayUI. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.
1. Introduction to LayUI
Layui is a domestic front-end UI framework written using its own module specifications. It follows the writing and organizational form of native HTML/CSS/JS. The threshold is extremely low. Ready to use. Built-in UI framework with some common elements and components.
After downloading, introduce it into the project.
2. Introduction to LayPage parameters
laypage is a built-in encapsulated object, which can be called directly when paging. There are mainly the following parameters here for configuring laypage. Key-value pair collection:
Key |
Default value |
Type |
Description |
cont |
Required |
String/Object |
Container. The value can be passed in the element id or native DOM or jquery object |
pages |
Required |
Number |
Page number |
##curr | 1 | Number | ##Current page.|
5 | Number | Number of consecutive pages. | |
default | String | Control paging skin | |
1 | Number/String/Boolean | is used to control the homepage. first: false, it means not to display the homepage items | |
Total page value | Number/String/Boolean | is used to control the last page. last: false, it means not to display the last page item | |
Previous page | String/Boolean | is used to control the previous page. If not displayed, set false | |
Next page | String/Boolean | is used to control the next page. If it is not displayed, set false | |
Core parameters | Function | Triggers the callback after paging, and the function returns two parameters. | obj is an object type. Contains all configuration information for paging.First a Boolean class to detect whether the page is initially loaded. Very useful to avoid infinite refreshes. |
Related recommendations:
A very easy-to-use front-end paging js tool class
About 10 articles recommended for front-end paging
jQuery front-end paging example sharing_jquery
The above is the detailed content of LayUI implements front-end paging function. For more information, please follow other related articles on the PHP Chinese website!