PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

在Vue2.5中通过Table 和 Pagination 组件如何实现分页功能

亚连
亚连 原创
2018-06-09 14:22:10 2171浏览

这篇文章主要介绍了Vue2.5 结合 Element UI 之 Table 和 Pagination 组件实现分页功能,非常不错,具有参考借鉴价值,需要的朋友可以参考下

2017年底了,总结了这一年多来的前端之路,Vue从入门到放弃,再二进宫,从 Vue1.0 持续跟踪到 Vue2.5。结合公司的一些实际项目,也封装了一些比较实用的组件。

由于现在公司管理平台主要运用Element UI,索性就结合组件Table 和 Pagination 封装了一个支持页面切换的Table组件,不啰嗦,直接上代码。

2、实现思路

2.1、Element UI 引入(整体引入)

main.js

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

2.2、开始封装 iTable.vue 组件 (骨架)

由于公司项目都是以 i 开头,所以,为了区分组件和页面,习惯于组件命名也以 i 开头。 首先把 Table 、 Pagination 组件加进来


   
    
   
   
  
  
  
  
  
  
   
   
    
    {{ btn.label }}
    
    

       

            

            筛选过滤  

        表格操作  

   

 @import "../../assets/styles/mixins";  .table {  height: 100%;  .el-pagination {   float: right;   margin: 20px;  }  .el-table__header-wrapper, .el-table__fixed-header-wrapper {   thead {   tr {    th {    color: #333333;    }   }   }  }  .el-table-column--selection .cell {   padding: 0;   text-align: center;  }  .el-table__fixed-right {   bottom: 0 !important;   right: 6px !important;   z-index: 1004;  }  .operate-group {   display: flex;   flex-wrap: wrap;   .item {   margin-top: 4px;   margin-bottom: 4px;   display: block;   flex: 0 0 50%;   }  }  .filter-data {   top: e("calc((100% - 100px) / 3)");   background-color: rgba(0, 0, 0, 0.7);  }  .table-action {   top: e("calc((100% - 100px) / 2)");   background-color: rgba(0, 0, 0, 0.7);  }  .fix-right {   position: absolute;   right: 0;   height: 100px;   color: #ffffff;   width: 30px;   display: block;   z-index: 1005;   writing-mode: vertical-rl;   text-align: center;   line-height: 28px;   border-bottom-left-radius: 6px;   border-top-left-radius: 6px;   cursor: pointer;  }  }

上面是我整理给大家的,希望今后会对大家有帮助。

相关文章:

React Native中NavigatorIOS组件(详细教程说明)

有关ejsExcel模板使用方法

在D3.js中如何创建物流地图(详细教程)

以上就是在Vue2.5中通过Table 和 Pagination 组件如何实现分页功能的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。