How to implement paging function through Table and Pagination components in Vue2.5

亚连
Release: 2018-06-09 14:22:10
Original
2379 people have browsed it

This article mainly introduces how Vue2.5 combines the Table and Pagination components of Element UI to realize the paging function. It is very good and has reference value. Friends in need can refer to it

It’s the end of 2017, summary In the past year or so of the front-end road, Vue has gone from getting started to giving up, then entering the palace for the second time, and has 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