Appearance
pagination
说明
分页组件
使用
vue
<template>
...
<Pagination
v-model:limit="page.pageSize"
v-model:page="page.current"
:total="total"
@pagination="getUser"
>
</Pagination>
...
</div>
</template>
<script lang="ts" setup>
import { Pagination } from "liyao-vue-common"
const page: Record<string, any> = ref<UserQueryRequest>({
current: 1,
pageSize: 10
});
let total: number;
onMounted(() => {
getUser();
});
function getUser() {
return new Promise((resolve) => {
// 后端获取数据接口...
UserControllerService.listPageVo(page.value).then((res) => {
...
total = parseInt(res.data?.total);
...
});
});
}
</script>
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
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