1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
| <template>
| <div :class="{'hidden':hidden}" class="pagination-container">
| <el-pagination
| :background="background"
| :current-page.sync="currentPage"
| :page-size.sync="pageSize"
| :layout="layout"
| :page-sizes="pageSizes"
| :total="total"
| v-bind="$attrs"
| popper-class="select_bottom"
| @size-change="handleSizeChange"
| @current-change="handleCurrentChange"
| />
| </div>
| </template>
|
| <script>
| import { scrollTo } from '@/utils/scroll-to'
|
| export default {
| name: 'Pagination',
| props: {
| total: {
| required: true,
| type: Number
| },
| page: {
| type: Number,
| default: 1
| },
| limit: {
| type: Number,
| default: 20
| },
| pageSizes: {
| type: Array,
| default() {
| return [10, 20, 50, 100]
| }
| },
| layout: {
| type: String,
| default: 'total, sizes, prev, pager, next, jumper'
| },
| background: {
| type: Boolean,
| default: true
| },
| autoScroll: {
| type: Boolean,
| default: true
| },
| hidden: {
| type: Boolean,
| default: false
| }
| },
| computed: {
| currentPage: {
| get() {
| return this.page
| },
| set(val) {
| this.$emit('update:page', val)
| }
| },
| pageSize: {
| get() {
| return this.limit
| },
| set(val) {
| this.$emit('update:limit', val)
| }
| }
| },
| methods: {
| handleSizeChange(val) {
| this.$emit('pagination', { page: this.currentPage, limit: val })
| if (this.autoScroll) {
| scrollTo(0, 800)
| }
| },
| handleCurrentChange(val) {
| this.$emit('pagination', { page: val, limit: this.pageSize })
| if (this.autoScroll) {
| scrollTo(0, 800)
| }
| }
| }
| }
| </script>
|
| <style scoped>
| .pagination-container {
| background: #f8f8fa;
| padding: 10px 0;
| }
|
| .pagination-container.hidden {
| display: none;
| }
|
| /*::v-deep .el-pagination__sizes .el-input .el-input__inner:hover{*/
| /* border-color: #42b983 ;*/
| /*}*/
| /*::v-deep .el-pagination__sizes .el-input .el-input__inner:focus{*/
| /* border-color: #42b983;*/
| /*}*/
|
| </style>
| <style lang="scss">
| .select_bottom {
| //z-index: 2008; position: absolute; left: 147px !important; top: 355px !important; margin: 0px;
| //border: 1px solid #55aaff;
| //.el-select-dropdown {
| //
| //}
| //.el-select-dropdown {
| // background-color: #ffffff;
| //}
|
| //.el-select-dropdown__item.selected {
| // color: #42b983;
| //}
|
| //.el-select-dropdown__item.hover,
| //.el-select-dropdown__item:hover {
| // background: red;
| // color: #fff;
| //}
| }
|
| .el-pagination button, .el-pagination span:not([class*=suffix]) {
| font-size: 14px;
| }
|
| .el-pagination .el-select .el-input .el-input__inner {
| line-height: 34px;
| height: 34px;
| }
|
| .el-pagination__jump {
| margin-left: 10px;
| margin-right: 10px;
| }
|
| .el-pagination__jump .el-input .el-input__inner{
| line-height: 34px;
| height: 34px;
| }
| </style>
|
|