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.
main .js
// Element UI import Element from 'element-ui' // 默认样式 import 'element-ui/lib/theme-chalk/index.css'
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
Develop a good habit of writing comments. The amount of comments for personal projects will basically not be less than 30%
In addition to the columns parameter and the operators parameter, the other parameters should be easy to understand, okay. Then we will explain these two parameters in detail, then we need to combine the component iTable.vue to explain. Next, we will add muscles and blood vessels to iTable.vue, and the codes are posted. What is more difficult to understand is the render parameter in columns, which uses Vue's virtual tags in order to be able to use various html tags and other components of element UI in the columns of the table as desired. (You can also write it directly and see if the table component can be recognized, hahaha!) This is probably a difficult place to understand for those who are just getting started. For more details, you can first look at vue's render for a clearer explanation. , if some friends don’t understand, you can send me a private message directly~~~
{{scope.row[column.prop]}}
{{ btn.label }} 筛选过滤
表格操作
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Summary of jQuery code optimization methods
Detailed explanation of asymmetric encryption of Node.js
CSS3 to achieve tilt and rotation animation effects
How to deal with incomplete page display in 360 browser compatibility mode
The above is the detailed content of Implementation of component paging function in Vue2.5 and Element UI. For more information, please follow other related articles on the PHP Chinese website!