Vue backend management system implementation of paging function example

Vue backend management system implementation of paging function example

This article mainly introduces the implementation of the paging function of the Vue background management system, and shares it with you, as follows:

Effect picture:

Functional description:

  • Display the total number of data
  • You can choose the number of items to display per day
  • Click on the page number to jump to the specified page
  • Enter the page number to jump to the specified page

1. Function Implementation

1.1 Structure

        <!-- Pagination -->
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="queryInfo.pagenum"
          :page-sizes="[2, 5, 10, 15]"
          :page-size="queryInfo.pagesize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
        >
        </el-pagination>

1.2 Logic

    data() {
      return {
        //Request parameter queryInfo: {
          type: 3,
          //Current page number pagenum: 1,
          //Specify the number of pages displayed pagesize: 5,
        },
        goodsList: [],
        //Total data total: 0,
      }
    }
 
  methods: {
      //Get product classification data async getGoodsCate() {
        const { data: res } = await this.$http.get("categories", {
          params: this.queryInfo,
        })
        if (res.meta.status !== 200) {
          this.$message.error("Failed to get parameters")
        }
        this.total = res.data.total
        this.goodsList = res.data.result
        //console.log(this.goodsList)
      },
      //Monitor the number of entries per page handleSizeChange(pagesize) {
        // console.log(`${val} items per page`)
        this.queryInfo.pagesize = pagesize
        this.getGoodsCate()
      },
      //Monitor the current page number handleCurrentChange(pageNum) {
        this.queryInfo.pagenum = pageNum
        this.getGoodsCate()
      },
    },

1.3 Parameter Description

1.4 Effect Demonstration

This is the end of this article about the Vue backend management system's implementation of the paging function example. For more relevant Vue paging content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Vue3 encapsulates its own paging component
  • Vue+Element realizes paging effect
  • Vue implements paging function
  • Vue project realizes paging effect
  • Vue+Element-U realizes paging display effect
  • vue+Element-ui front-end realizes paging effect

<<:  Detailed explanation of commonly used styles in CSS3 [Basic text and font styles]

>>:  How to point the target link of a tag to iframe

Recommend

A brief discussion on docker-compose network settings

Networks usage tutorial Official website docker-c...

Linux hardware configuration command example

Hardware View Commands system # uname -a # View k...

Basic knowledge of website design: newbies please read this

Now many people are joining the ranks of website ...

Mysql database master-slave separation example code

introduce Setting up read-write separation for th...

Axios cancel request and avoid duplicate requests

Table of contents origin status quo Cancel reques...

Introduction to HTML for front-end developers

1 Introduction to HTML 1.1 First experience with ...

Some suggestions for HTML beginners and novices, experts can ignore them

Feelings: I am a backend developer. Sometimes when...

Dockerfile implementation code when starting two processes in a docker container

I want to make a docker for cron scheduled tasks ...

In-depth understanding of the seven communication methods of Vue components

Table of contents 1. props/$emit Introduction Cod...

Steps to solve the MySQL 8.0 time zone problem

Software Version Windows: Windows 10 MySQL: mysql...

Detailed steps for deepin20 to install NVIDIA closed-source drivers

Step 1: Install the deep "graphics driver&qu...

How to start a Vue.js project

Table of contents 1. Node.js and Vue 2. Run the f...

Solution to mysql login warning problem

1. Introduction When we log in to MySQL, we often...