fix(cli): should remove light theme class in dark mode (#11039)

This commit is contained in:
neverland 2022-09-12 11:05:44 +08:00 committed by GitHub
parent 6a9d5515ce
commit cbbdad909a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -27,13 +27,19 @@ export default {
document.documentElement.classList.remove(`van-doc-theme-${oldVal}`);
document.documentElement.classList.add(`van-doc-theme-${newVal}`);
const { darkModeClass } = config.site;
const { darkModeClass, lightModeClass } = config.site;
if (darkModeClass) {
document.documentElement.classList.toggle(
darkModeClass,
newVal === 'dark'
);
}
if (lightModeClass) {
document.documentElement.classList.toggle(
lightModeClass,
newVal === 'light'
);
}
},
{ immediate: true }
);

View File

@ -24,6 +24,7 @@ export default {
site: {
defaultLang: 'en-US',
darkModeClass: 'van-theme-dark',
lightModeClass: 'van-theme-light',
versions: [
{ label: 'v1', link: '/vant/v1/' },
{ label: 'v2', link: '/vant/v2/' },