element-plus/docs/.vitepress/vitepress/composables/dark.ts
2022-02-28 11:31:43 +08:00

11 lines
307 B
TypeScript

import { useDark, useToggle } from '@vueuse/core'
export const isDark =
// @ts-expect-error when PROD is true, do not useDark
import.meta.env.DEV &&
useDark({
storageKey: 'el-theme-appearance',
})
// remove as boolean when dark mode is ok
export const toggleDark = useToggle(isDark as boolean)