mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
fix: darkMock provide fail in windows
This commit is contained in:
parent
ccebdeff66
commit
56cd453b52
@ -1,4 +1,4 @@
|
||||
import { inject, provide, ref } from 'vue'
|
||||
import { inject, onMounted, provide, ref } from 'vue'
|
||||
import type { InjectionKey, Ref } from 'vue'
|
||||
|
||||
export type DarkModeRef = Ref<boolean>
|
||||
@ -23,11 +23,10 @@ export const useDarkMode = (): DarkModeRef => {
|
||||
*/
|
||||
export const setupDarkMode = (): void => {
|
||||
const isDark = ref<boolean>(false)
|
||||
if (
|
||||
typeof document !== 'undefined' &&
|
||||
document.documentElement.classList.contains('dark')
|
||||
) {
|
||||
isDark.value = true
|
||||
}
|
||||
onMounted(() => {
|
||||
if (document.documentElement.classList.contains('dark')) {
|
||||
isDark.value = true
|
||||
}
|
||||
})
|
||||
provide(darkModeSymbol, isDark)
|
||||
}
|
||||
|
||||
@ -276,8 +276,8 @@ div[class*='language-'] {
|
||||
}
|
||||
}
|
||||
|
||||
.code-tabs-nav {
|
||||
margin-bottom: -0.85rem;
|
||||
.plume-content .vp-code-tabs-nav {
|
||||
margin: 0 -1.5rem -0.85rem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -19,16 +19,21 @@ export const mergeLocaleOptions = (options: PlumeThemeLocaleOptions) => {
|
||||
if (!options.locales) {
|
||||
options.locales = {}
|
||||
}
|
||||
if (!options.locales['/']) {
|
||||
options.locales['/'] = {}
|
||||
const { locales, ...otherOptions } = options
|
||||
|
||||
if (!locales['/']) {
|
||||
locales['/'] = {}
|
||||
}
|
||||
Object.assign(options, {
|
||||
...defaultLocaleOption,
|
||||
...options,
|
||||
})
|
||||
Object.assign(options.locales['/'], {
|
||||
|
||||
Object.assign(locales['/'], {
|
||||
...defaultLocaleOption,
|
||||
...options.locales['/'],
|
||||
...JSON.parse(JSON.stringify(otherOptions)),
|
||||
...locales['/'],
|
||||
})
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user