Vue component library ElementUI realizes the paging effect of table list

Vue component library ElementUI realizes the paging effect of table list

ElementUI implements the table list paging effect tutorial for your reference. The specific contents are as follows

Element UI is a component library based on Vue 2.0, a component library based on Vue 2.0 for developers, designers and product managers, providing supporting design resources to help websites take shape quickly.

<el-pagination> adds @size-change="handleSizeChange", @current-change="handleCurrentChange" to handle the change events of the current page and the current number of pages

<!--Table-->
<div class="formTable" id="formTable">
<el-table
  ref="Table"
  :data="apprItemData"
  :header-cell-style="headClass"
         row-key="approveItem"
         :tree-props="{children: 'children'}"
         height="420"
  border>
 <el-table-column
   type="selection"
   width="55">
 </el-table-column>
 <el-table-column
   label="Serial number"
   width="60"
   align="center">
  <template slot-scope="scope">{{scope.$index+1}}</template>
 </el-table-column>
 <el-table-column
   prop="itemCode"
   label="encoding">
 </el-table-column>
 <el-table-column
   prop="approveName"
   label="Item Name">
 </el-table-column>
</el-table>
</div>
<!--Table Pagination-->
<div class="pagination">
 <el-pagination
   background
   @size-change="handleSizeChange"
   @current-change="handleCurrentChange"
   :page-sizes="[5,10, 15, 20, 25]"
   :page-size="pageSize"
   layout="total, sizes, prev, pager, next, jumper"
   :total="totalRow">
 </el-pagination>
</div>
<script type="text/babel">
 var vm = new Vue({
     el: '#app',
     data:{
         apprItemData : [],
         currentPage: 1, //Current page totalRow: 0, //Total number of pages pageSize: 10 //Current number of displayed items},
     computed: {},
     watch: {},
     created() {},
     mounted() {
         this.loadItemData();
},
     methods: {
         // Load information loadItemData () {
             var pageSize = this.pageSize;
             var currentPage = this.currentPage;
             console.log("pageSize:"+pageSize+",currentPage:"+currentPage);
 //debugger;
 var geturl = '${root}/config/loadItemData.do?rows='+pageSize + '&page=' + currentPage;
             $.ajax({
                 type: 'get',
                 url:geturl,
                 contentType: "application/json; charset=utf-8",
                 success: function(data) {
                     //debugger;
                     console.log("totalRow:"+data.total);
                     vm.apprItemData = data.rows;
                     vm.totalRow = Number(data.total);
                 },
                 error: function(e) {
                     console.log("Error in loading data:",e);
                 }
             })
         }
         // Header style settings headClass() {
             return 'text-align: center;background:#F7F7F7;color:#1C1C1D;'
         },
         //Page number change handleSizeChange(val) {
             this.pageSize = val;
             this.loadItemData();
         },
         //Current page change handleCurrentChange(val) {
             this.currentPage = val;
             this.loadItemData();
         }
     }
 });
</script> 

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:
  • Vue elementUI form nested table and verification of each row detailed explanation
  • Vue elementUI implements tree structure table and lazy loading
  • Vue+ElementUI table realizes table paging
  • Vue+elementUI realizes table keyword filtering and highlighting
  • Vue2.0+ElementUI implements table page turning example
  • Detailed explanation of ElementUI table based on Vue

<<:  Detailed explanation of the workbench example in mysql

>>:  VMware12 installs Ubuntu19.04 desktop version (installation tutorial)

Recommend

Detailed graphic explanation of sqlmap injection

Table of contents 1. We found that this website m...

8 examples of using killall command to terminate processes in Linux

The Linux command line provides many commands to ...

How to use Docker to build enterprise-level custom images

Preface Before leaving get off work, the author r...

Several solutions for forgetting the MySQL password

Solution 1 Completely uninstall and delete all da...

Detailed explanation of several ways to create a top-left triangle in CSS

Today we will introduce several ways to use CSS t...

An audio-visual Linux distribution that appeals to audiophiles

I recently stumbled upon the Audiovisual Linux Pr...

Detailed explanation of Vue life cycle

Table of contents Why understand the life cycle W...

Detailed explanation of HTML page header code example

Knowledge point 1: Set the base URL of the web pa...

Detailed explanation of the role of static variables in MySQL

Detailed explanation of the role of static variab...

CSS Sticky Footer Several Implementations

What is "Sticky Footer" The so-called &...

HTML elements (tags) and their usage

a : Indicates the starting or destination positio...

Usage instructions for the docker create command

The docker create command can create a container ...

Simple implementation method of Linux process monitoring and automatic restart

Purpose: Under Linux, the server program may be d...