更改element-ui中的分页器样式——功能实现
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element

·
在工作过程中,经常会用到table
表格用于数据的展示,对应的数据过多时,则需要用到分页器。
elementUi
中已经有了很多分页器的样式,完全可以满足正常的使用需求。
如果想要实现下方的分页器的样式,则需要改动样式及部分功能:
首先可以看到想要的效果图中,跟elementUi
中红框标注的样式很类似。
区别在于:
- 页码的背景颜色及边框
- 上页 下页将图标改为文字
- 添加首页 尾页
html
部分代码如下:
<div class="page">
<div class="homePage" v-on:click="homePageFn">首页</div>
<el-pagination prev-text="上页" next-text="下页"
v-on:current-change="handleCurrentChange"
:current-page="searchInfo.PageIndex"
:page-size="searchInfo.PageSize"
layout="prev, pager, next"
:total="TotalCount">
</el-pagination>
<div class="lastPage" v-on:click="lastPageFn">尾页</div>
</div>
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
css
样式部分代码如下:
.page {
display: flex;
justify-content: center;
align-items: center;
font-size: 13px;
color: #656565;
margin-top: 20px;
padding-bottom: 20px;
}
.page > div.homePage, .page > div.lastPage {
height: 34px;
line-height: 34px;
width: 50px;
text-align: center;
border: 1px solid #EAEAEA;
box-sizing: border-box;
cursor: pointer;
}
.page > div.homePage {
border-right: none;
border-radius: 2px 0 0 2px;
}
.page > div.lastPage {
border-left: none;
border-radius: 0 2px 2px 0;
}
.el-pagination {
text-align: center;
padding: 0;
}
.el-pagination > button {
padding: 0 !important;
height: 34px !important;
}
.el-pagination > button.btn-prev {
border-right: none !important;
}
.el-pagination span {
color: #656565;
width: 50px;
border: 1px solid #EAEAEA;
height: 34px !important;
line-height: 34px !important;
box-sizing: border-box;
}
.el-pagination .el-pager .number, .el-icon.more.el-icon-more {
color: #656565 !important;
border: 1px solid #EAEAEA;
height: 34px !important;
line-height: 34px !important;
box-sizing: border-box;
}
.el-icon.more.btn-quicknext.el-icon-more {
border-right: none;
}
.el-icon.more.btn-quickprev.el-icon-more {
border-left: none;
}
.el-pagination .el-pager .number:not(:first-child) {
border-right: none !important;
}
.el-pagination .el-pager .number.active {
background: #FF9900;
border: 1px solid #FF9900;
color: #FFFFFF !important;
}
js
部分代码如下:
homePageFn() {
if (this.searchInfo.PageIndex == 1) {
return;
}
this.searchInfo.PageIndex = 1;
//this.getList(); 调取列表数据
},
lastPageFn() {
var lastPage = Math.ceil(this.TotalCount / this.searchInfo.PageSize);
if (this.searchInfo.PageIndex == lastPage) {
return;
}
this.searchInfo.PageIndex = lastPage;
//this.getList();调取列表数据
},
阅读全文
AI总结




A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:7 个月前 )
c345bb45
11 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 11 个月前
更多推荐
相关推荐
查看更多
element

A Vue.js 2.0 UI Toolkit for Web
element

element

热门开源项目
活动日历
查看更多
直播时间 2025-03-13 18:32:35

全栈自研企业级AI平台:Java核心技术×私有化部署实战
直播时间 2025-03-11 18:35:18

从0到1:Go IoT 开发平台的架构演进与生态蓝图
直播时间 2025-03-05 14:35:37

国产工作流引擎 终结「996」开发困局!
直播时间 2025-02-25 14:38:13

免费开源宝藏 ShopXO,电商系统搭建秘籍大公开!
直播时间 2025-02-18 14:31:04

从数据孤岛到数据智能 - 企业级数据管理利器深度解析
所有评论(0)