onThemeChange
- Category:
Events
- Relate:
onThemeChange
- Dependencies:
@lark-base-open/js-sdk
- Last Changed: 2 weeks ago
提示
该函数需要在一个多维表格中使用,请将本文档作为一个插件在多维表格上使用以查看演示。
演示
显示演示代码
vue
<script setup lang="ts">
import { onThemeChange } from "@qww0302/use-bitable"
import { bitable } from "@lark-base-open/js-sdk"
import { ref, onMounted } from "vue"
const theme = ref("LIGHT")
onThemeChange((t) => {
theme.value = t
})
onMounted(()=>{
bitable.bridge.getTheme().then((t) => {
theme.value = t
})
})
</script>
<template>
<div>
Current theme: {{ theme }}
</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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
用法
类型声明
ts
import { type ThemeModeType } from "@lark-base-open/js-sdk"
/**
* Listen to theme change
*
* 监听主题变化
*
* @param callback
* @returns
*/
export declare function onThemeChange(
callback: (theme: ThemeModeType) => void,
): () => void
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12