功能:新增云管API与Web控制台并完成现场接入
This commit is contained in:
1 parent
18a9ce995d
commit
3fb7b4da8c
79 files changed
+17367
-3
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
const key = 'vdi.theme'
|
||||
const saved = (() => { try { return localStorage.getItem(key) } catch { return null } })()
|
||||
const theme = ref<'dark' | 'light'>(saved === 'light' ? 'light' : 'dark')
|
||||
function apply() {
|
||||
document.documentElement.dataset.theme = theme.value
|
||||
document.documentElement.style.colorScheme = theme.value
|
||||
}
|
||||
apply()
|
||||
export function useTheme() {
|
||||
const dark = computed(() => theme.value === 'dark')
|
||||
function toggle() {
|
||||
theme.value = dark.value ? 'light' : 'dark'
|
||||
apply()
|
||||
try { localStorage.setItem(key, theme.value) } catch { /* The theme still works without browser storage. */ }
|
||||
}
|
||||
return { theme, dark, toggle }
|
||||
}
|
||||
Reference in new issue
Block a user