FooterPagination.vue
956 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
<template>
<div class="wrapper">
<el-pagination
background
layout="total, prev, pager, next, sizes, jumper"
:total="pagination.total"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
></el-pagination>
</div>
</template>
<script>
export default {
props: {
total: {
type: Number,
default: 0
}
},
data() {
return {
pagination: {
size: 10,
total: this.total,
page: 1
}
}
},
watch: {
total(val) {
this.pagination.total = val
}
},
mounted() {
this.$emit('pager', { ...this.pagination })
},
methods: {
handleCurrentChange(page) {
this.$emit('pager', { ...this.pagination, page })
},
handleSizeChange(size) {
this.$emit('pager', { ...this.pagination, size })
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
display: flex;
justify-content: flex-end;
}
</style>