This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nezha-nezha-fronted/nezha-fronted/src/components/common/pagination.vue

138 lines
3.5 KiB
Vue
Raw Normal View History

<template>
<div class="pagination">
<el-pagination
ref="page"
@size-change="size"
@prev-click="prev"
@next-click="next"
@current-change="current"
:current-page="pageObj.pageNo"
:page-sizes="pageSizes?pageSizes:[20, 50, 100]"
:page-size="pageSize"
2020-01-17 16:06:35 +08:00
layout="total, prev, pager, next,sizes,jumper"
:total="this.pageObj.total"
></el-pagination>
</div>
</template>
<script>
export default {
name: "pagination",
props: ['pageObj','pageSizes', 'tableId'],
data() {
return {
pageSize: 20
};
},
methods: {
background() {
this.backgroundColor();
},
//点击上一页箭头
prev() {
this.backgroundColor();
},
//点击下一页箭头
next(val) {
this.backgroundColor();
},
//currentPage 改变时会触发
current(val) {
this.$emit("pageNo", val);
this.backgroundColor();
},
size(val) {
this.$emit("pageSize", val);
this.backgroundColor();
},
//设置当前页的样式
backgroundColor() {
this.list = this.$refs.page.$el.children[2].children;
for (let i = 0; i < this.list.length; i++) {
const element = this.list[i];
//console.info(element)
}
},
},
mounted() {
let pageSize = localStorage.getItem('nz-pageSize-' + localStorage.getItem('nz-username') + '-' + this.tableId);
this.pageSize = this.pageSizes && this.pageSizes.length > 0 ? this.pageSizes[0] : (pageSize ? pageSize : 20);
this.$nextTick(() => {
let input = document.querySelector(".el-pagination .el-select .el-input__inner");
input.value = this.pageSize + this.$t('pageSize');
});
}
};
</script>
2020-01-19 17:03:16 +08:00
<style lang="scss">
2020-01-17 16:06:35 +08:00
.el-pagination__total {
float: left;
}
2020-01-17 15:09:32 +08:00
.pagination {
padding-top: 8px;
2020-01-17 15:09:32 +08:00
text-align: center;
}
.el-pager li, .el-pagination .btn-next, .el-pagination .btn-prev {
2020-01-17 17:08:10 +08:00
margin:5px 5px 0px 5px;
2020-01-17 15:09:32 +08:00
padding: 0 4px;
font-size: 13px;
min-width: 20px;
height: 20px;
line-height: 20px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
text-align: center;
border: 1px solid rgba(154,154,154,0.20);
border-radius: 2px;
border-radius: 2px;
}
2020-01-17 17:08:10 +08:00
.el-pagination .el-pager li.btn-quicknext, .el-pager li.btn-quickprev {
line-height: 20px;
}
.el-pagination .el-pager .more::before {
line-height: 20px;
}
.el-pagination .el-pager .more {
background-color: $content-right-background-color;
}
.btn-next, .btn-prev {
background-color: $content-right-background-color !important;
}
.pagination input {
background-color: $content-right-background-color !important;
}
2020-01-17 15:09:32 +08:00
.el-pager li.number{
font-family: NotoSansSC-Regular;
color: #666666;
letter-spacing: 0;
font-weight:normal;
background-color: $content-right-background-color;
2020-01-17 15:09:32 +08:00
}
.el-pager li.number.active{
font-family: NotoSansSC-Regular;
color: #FFFFFF;
letter-spacing: 0;
}
2020-01-19 17:03:16 +08:00
.el-pagination .el-pager li.active {
background-color: $global-text-color-active;
2020-01-17 15:09:32 +08:00
border-radius: 2px;
border-radius: 2px;
}
.el-pager li:hover, .el-pagination .btn-next:hover, .el-pagination .btn-prev:hover {
2020-01-17 15:09:32 +08:00
font-family: NotoSansSC-Regular;
color: #666666;
letter-spacing: 0;
font-weight:normal;
}
.el-pagination__sizes .el-input .el-input__inner,.el-pagination__editor.el-input .el-input__inner{
height: 20px;
border-color: rgba(154,154,154,0.20);
}
.el-pagination__sizes .el-input .el-input__inner:hover{
border-color: rgba(154,154,154,0.20);
}
</style>