更新任务
This commit is contained in:
1 parent
120a57ad57
commit
6118a80ac4
279 files changed
+9682
-2362
No files matched your search
@@ -0,0 +1,25 @@
|
||||
<template></template>
|
||||
<script setup lang="ts">
|
||||
import { useData } from 'vitepress'
|
||||
import { watch } from 'vue'
|
||||
|
||||
const { isDark } = useData()
|
||||
|
||||
// tdesign 暗色切换 https://tdesign.tencent.com/vue-next/dark-mode
|
||||
watch(
|
||||
isDark,
|
||||
() => {
|
||||
if (typeof document !== 'undefined') {
|
||||
// 使用document的代码
|
||||
if (isDark.value) {
|
||||
document.documentElement.setAttribute('theme-mode', 'dark')
|
||||
} else {
|
||||
document.documentElement.removeAttribute('theme-mode')
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
)
|
||||
</script>
|
||||
Reference in new issue
Block a user