Pagination.vue
1018 Bytes
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
<template>
<a-pagination
v-model="current"
:page-size-options="pageSizeOptions"
:total="total"
show-size-changer
:page-size="pageSize"
@showSizeChange="onShowSizeChange"
:show-total="(total, range) => `${range[0]}-${range[1]} 共 ${total} 条`"
>
</a-pagination>
</template>
<script>
export default {
props: {
total: {
type: Number,
default: 0,
},
pageSizeOptions: {
type: Array,
default() {
return ['10', '20', '50', '100']
},
},
},
data() {
return {
pageSize: 10,
current: 1,
}
},
mounted() {},
methods: {
onShowSizeChange(current, pageSize) {
this.pageSize = pageSize
this.current = current
this.$emit('onShowSizeChange', current, pageSize)
},
},
watch: {
current(val) {
this.$emit('onShowSizeChange', val, this.pageSize)
},
},
}
</script>
<style scoped>
.ant-pagination {
text-align: right !important;
margin-top: 20px !important;
}
</style>