Vue+Element realizes paging effect

Vue+Element realizes paging effect

This article example shares the specific code of vue+Element to achieve the paging effect for your reference. The specific content is as follows

The general style is that the card contains lists and paging

Here is the code directly

<el-card>
  <!-- User List Area -->
  <el-table :data="rightsList.slice((currentPage-1)*pagesize,currentPage*pagesize)" border stripe>
    <el-table-column label="#" type="index"></el-table-column>
    <el-table-column label="Authorization Name" prop="authName"></el-table-column>
  </el-table>

  <!--Paging area-->
  <el-pagination
      @size-change="size_change" //Triggered when pageSize changes @current-change="current_change" //Triggered when currentPage changes:current-page="currentPage" //Current page number:page-sizes="[10,20,30]" //Option setting for the selector of the number of items displayed per page:page-size="pagesize" //Number of items displayed per page layout="total, sizes, prev, pager, next, jumper" //Component layout:total="rightsList.length //Total number of items"> 
  </el-pagination>
</el-card>

Then define the data

data() {
   return {
        rightsList:[], //list data total:0, //total number of entries pagesize:10, //number of entries displayed per page currentPage:1, //current page number}
},

Listening for change events

methods:{
   //Listen for pagesize change events size_change(newSize){
       this.pagesize = newSize
   }
   //Listen for page value changes current_change(newPage){
       this.currentPage = newPage
   },
   
}

The effect is as shown

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to use vue + element to implement table paging and front-end search
  • Vue+element-ui implements table paging function example
  • Implementation of paging problem of vue + element-ui
  • An example of using vue and element-ui to set table content paging
  • vue+element tabs tab paging effect
  • Vue+ElementUI table realizes table paging
  • vue+elementUI component table realizes front-end paging function
  • vue+Element-ui front-end realizes paging effect
  • Vue imitates element to achieve paging effect
  • Vue+Element-U realizes paging display effect

<<:  Vue+Router+Element to implement a simple navigation bar

>>:  Implementation of docker-compose deployment of zk+kafka+storm cluster

Recommend

Vue realizes adding watermark to uploaded pictures (upgraded version)

The vue project implements an upgraded version of...

Complete steps to configure IP address in Ubuntu 18.04 LTS

Preface The method of configuring IP addresses in...

Summary of SQL deduplication methods

When using SQL to extract data, we often encounte...

Summary of 50+ Utility Functions in JavaScript

JavaScript can do a lot of great things. This art...

SQL injection vulnerability process example and solution

Code example: public class JDBCDemo3 { public sta...

Vue shopping cart case study

Table of contents 1. Shopping cart example 2. Cod...

Tutorial on using $attrs and $listeners in Vue

Table of contents introduce Example Summarize int...

Understanding and using React useEffect

Table of contents Avoid repetitive rendering loop...

A detailed summary of HTML tag nesting rules suitable for beginners

I have been relearning HTML recently, which can be...

Analysis and treatment of scroll bars in both HTML and embedded Flash

We often encounter this situation when doing devel...

iFrame is a great way to use it as a popup layer to cover the background

I have been working on a project recently - Budou ...

Summary of some common uses of refs in React

Table of contents What are Refs 1. String type Re...