zoukankan      html  css  js  c++  java
  • elemet-paging

    <template>
        <card-layout :title="L('Prosuct')" :actions="actions" @click="handleClick">
            <el-table :data="tableData4.slice((currentPage-1) * pagesize,currentPage*pagesize)" style=" 100%" max-height="250">
                <el-table-column fixed prop="date" label="日期" width="150">
                </el-table-column>
                <el-table-column prop="name" label="姓名" width="120">
                </el-table-column>
                <el-table-column prop="province" label="省份" width="120">
                </el-table-column>
                <el-table-column prop="city" label="市区" width="120">
                </el-table-column>
                <el-table-column prop="address" label="地址" width="300">
                </el-table-column>
                <el-table-column prop="zip" label="邮编" width="120">
                </el-table-column>
                <el-table-column fixed="right" label="操作" width="180">
                    <template slot-scope="scope">
                        <el-button type="danger" @click.native.prevent="deleteRow(scope.$index, tableData4)" size="small">
                            移除
                        </el-button>
                        <el-button type="primary" size="small">
                            编辑
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[5, 10, 20, 40]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="tableData4.length">
            </el-pagination>
        </card-layout>
    </template>
    
    <script>
    export default {
      methods: {
        deleteRow(index, rows) {
          rows.splice(index, 1);
        }
      },
      data() {
        return {
          tableData4: [
          ],
          actions: [
            [
              {
                id: "New",
                type: "primary",
                text: "New",
                icon: "el-icon-circle-plus-outline"
              },
              {
                id: "Refresh",
                type: "success",
                text: "Refresh",
                icon: "fa fa-refresh"
              }
            ]
          ],
          currentPage: 1, //初始页
          pagesize: 5, //    每页的数据
        };
      },
      methods: {
        handleClick(id) {
          switch (id) {
            case "New":
              this.AddProduct();
              break;
            case "Refresh":
              this.Refresh();
              break;
            default:
              break;
          }
        },
        deleteRow(index, rows) {
          rows.splice(index, 1);
        },
        AddProduct() {
          console.log("add");
        },
        Refresh() {
          console.log("refresh");
        },
        handleSizeChange(size) {
           this.pagesize = size;
        },
        handleCurrentChange(currentPage) {
           this.currentPage = currentPage;
        }
      }
    };
    </script>
  • 相关阅读:
    U1. 广度优先搜索(BFS)和 广度优先搜索(DFS)
    C5. Spring 服务的注册与发现(Spring Cloud Eureka)
    S3. Android 消息推送
    S2. Android 常用控件
    S12. Android 检查更新功能实现
    S1. Android 功能大全
    B9 Concurrent 重入锁(ReentrantLock)
    117.dom2事件
    106.事件的传播机制
    105.事件对象及兼容处理
  • 原文地址:https://www.cnblogs.com/huanhuan55/p/9860754.html
Copyright © 2011-2022 走看看