This commit is contained in:
parent
00a858761c
commit
d4e76e0b0b
@ -1,5 +1,5 @@
|
|||||||
import type { App, InjectionKey, Ref } from 'vue'
|
import type { App, InjectionKey, Ref } from 'vue'
|
||||||
import { useDark } from '@vueuse/core'
|
import { useDark, useEventListener } from '@vueuse/core'
|
||||||
import { inject, ref } from 'vue'
|
import { inject, ref } from 'vue'
|
||||||
import { useThemeData } from './theme-data.js'
|
import { useThemeData } from './theme-data.js'
|
||||||
|
|
||||||
@ -50,6 +50,16 @@ export function setupDarkMode(app: App): void {
|
|||||||
Object.defineProperty(app.config.globalProperties, '$isDark', {
|
Object.defineProperty(app.config.globalProperties, '$isDark', {
|
||||||
get: () => isDark,
|
get: () => isDark,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
useEventListener('beforeprint', () => {
|
||||||
|
if (isDark.value)
|
||||||
|
document.documentElement.dataset.theme = 'light'
|
||||||
|
})
|
||||||
|
|
||||||
|
useEventListener('afterprint', () => {
|
||||||
|
if (isDark.value)
|
||||||
|
document.documentElement.dataset.theme = 'dark'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user