Skip to content

Commit 0506c4e

Browse files
committed
重构:在 config 列表,引入分页组件
1 parent ba563f7 commit 0506c4e

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/components/Pagination/index.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :class="{ 'hidden': hidden }" class="pagination-container">
2+
<div :class="{ hidden }" class="pagination-container">
33
<el-pagination
44
:background="background"
55
v-model:current-page="currentPage"
@@ -18,6 +18,7 @@
1818
// TODO 芋艿:ts 重写
1919
// TODO 芋艿:scrollTo 接入
2020
// import { scrollTo } from '@/utils/scroll-to'
21+
import { computed } from 'vue'
2122
2223
const props = defineProps({
2324
total: {
@@ -38,7 +39,7 @@ const props = defineProps({
3839
return [10, 20, 30, 50]
3940
}
4041
},
41-
// 移动端页码按钮的数量端默认值5
42+
// 移动端页码按钮的数量端默认值 5
4243
pagerCount: {
4344
type: Number,
4445
default: document.body.clientWidth < 992 ? 5 : 7
@@ -61,7 +62,7 @@ const props = defineProps({
6162
}
6263
})
6364
64-
const emit = defineEmits();
65+
const emit = defineEmits(['update:page', 'update:limit', 'pagination', 'pagination'])
6566
const currentPage = computed({
6667
get() {
6768
return props.page
@@ -74,7 +75,7 @@ const pageSize = computed({
7475
get() {
7576
return props.limit
7677
},
77-
set(val){
78+
set(val) {
7879
emit('update:limit', val)
7980
}
8081
})
@@ -93,7 +94,6 @@ function handleCurrentChange(val) {
9394
// scrollTo(0, 800)
9495
}
9596
}
96-
9797
</script>
9898

9999
<style scoped>

src/views/infra/config/index.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@
103103
</template>
104104
</el-table-column>
105105
</el-table>
106+
<Pagination
107+
v-show="total > 0"
108+
:total="total"
109+
v-model:page="queryParams.pageNo"
110+
v-model:limit="queryParams.pageSize"
111+
@pagination="getList"
112+
/>
106113
</content-wrap>
107114

108115
<!-- 表单弹窗:添加/修改 -->
@@ -137,7 +144,7 @@ const getList = async () => {
137144
try {
138145
const data = await ConfigApi.getConfigPage(queryParams)
139146
list.value = data.list
140-
total.value = data.value
147+
total.value = data.total
141148
} finally {
142149
loading.value = false
143150
}

0 commit comments

Comments
 (0)