useRecordIdPage
- Category:
Composables
- Relate:
getRecordIdList
- Dependencies:
@lark-base-open/js-sdk
- Last Changed: 20 hours ago
提示
该函数需要在一个多维表格中使用,请将本文档作为一个插件在多维表格上使用以查看演示。
演示
显示演示代码
vue
<script setup lang="ts">
import { useRecordIdPage, useSelection, useTable } from "@qww0302/use-bitable";
const { tableId, viewId } = useSelection();
const { table } = useTable(tableId);
const { recordIds, pending, totalPage, curPage } = useRecordIdPage(table, {
viewId,
pageSize: 10,
});
const prevPage = () => {
curPage.value -= 1;
};
const nextPage = () => {
curPage.value += 1;
};
</script>
<template>
<div>
<div v-if="pending">Loading...</div>
<div v-else>
<div v-for="recordId in recordIds" :key="recordId">
{{ recordId }}
</div>
</div>
<div>
<button @click="prevPage" :disabled="pending || curPage === 0">Prev</button>
<span>{{ curPage + 1 }} / {{ totalPage }}</span>
<button @click="nextPage" :disabled="pending || curPage === totalPage">Next</button>
</div>
</div>
</template>
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
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
用法
类型声明
ts
import { MaybeRef } from "vue"
import type { MaybeRefOrGetter } from "vue"
import type { ITable, ISortInfo, IFilterInfo } from "@lark-base-open/js-sdk"
/**
* RecordId Page option
*/
interface RecordIdPageOption {
/**
* Per page size
*
* 每页大小
*
* @default 200
*/
pageSize?: number
/**
* Filter
*
* 过滤条件
*/
filter?: IFilterInfo
/**
* Sorts
*
* 排序
*/
sort?: ISortInfo[]
/**
* View ID
*
* 视图 ID
*/
viewId?: MaybeRef<string | null>
}
export declare function useRecordIdPage(
table: MaybeRefOrGetter<ITable | null>,
option: RecordIdPageOption,
): {
total: import("vue").Ref<number, number>
hasMore: import("vue").Ref<boolean, boolean>
recordIds:
| import("vue").ShallowRef<string[] | undefined>
| import("vue").Ref<string[], string[]>
pending: import("vue").Ref<boolean, boolean>
curPage: import("vue").WritableComputedRef<number, number>
totalPage: import("vue").ComputedRef<number>
}
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
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