onRecordModify
- Category:
Events
- Relate:
onRecordModify
- Dependencies:
@lark-base-open/js-sdk
- Last Changed: 2 weeks ago
提示
该函数需要在一个多维表格中使用,请将本文档作为一个插件在多维表格上使用以查看演示。
演示
显示演示代码
vue
<script setup lang="ts">
import { onRecordModify, useSelection } from "@qww0302/use-bitable"
import type { IEventCbCtx } from "@lark-base-open/js-sdk"
import { ref } from "vue"
const { tableId } = useSelection()
const ev = ref<IEventCbCtx<{
recordId: string;
fieldIds: string[];
}>>()
onRecordModify(tableId, (e) => {
ev.value = e
})
</script>
<template>
<div>
Try to modify a record:
<span v-if="ev">You have modified fields {{ ev.data.fieldIds }} of record {{ ev.data.recordId }}. </span>
<pre>{{ JSON.stringify(ev, null, 2) }}</pre>
</div>
</template>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
用法
类型声明
ts
import type { ITable, IEventCbCtx } from "@lark-base-open/js-sdk"
import { MaybeRefOrGetter } from "vue"
/**
* Listen to record modify event
*
* 监听记录修改事件
*
* @param table
* @param callback
* @returns
*/
export declare function onRecordModify(
table: MaybeRefOrGetter<ITable | string | null>,
callback: (
ev: IEventCbCtx<{
recordId: string
fieldIds: string[]
}>,
) => void,
): {
off: () => void
pending: import("vue").Ref<boolean>
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23