Implementation of component paging function in Vue2.5 and Element UI

php中世界最好的语言
Release: 2018-03-23 10:08:30
Original
4213 people have browsed it

This time I will bring you the components of Vue2.5 and Element UIPaging functionimplementation, what are thenotesof implementing the component paging function of Vue2.5 and Element UI, The following is a practical case, let’s take a look.

It’s the end of 2017, and I summarized the front-end road for more than a year. Vue went from getting started to giving up, then entered the palace for the second time, and continued to track from Vue1.0 to Vue2.5. Combined with some actual projects of the company, some more practical components are also encapsulated.

Since the current company management platform mainly uses Element UI, we simply combined the components Table and Pagination to encapsulate a Table component that supports page switching. No verbosity, just enter the code directly.

2. Implementation ideas

2.1. Introduction of Element UI (overall introduction)

main .js

// Element UI import Element from 'element-ui' // 默认样式 import 'element-ui/lib/theme-chalk/index.css'
Copy after login

2.2. Start encapsulating the iTable.vue component (skeleton)

Since the company's projects all start with i, in order to distinguish components and pages, it is customary Component names also start with i. First, add the Table and Pagination components