mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
fix: attach css variables to :root element (#11026)
This commit is contained in:
@@ -24,12 +24,15 @@ export default {
|
||||
watch(
|
||||
theme,
|
||||
(newVal, oldVal) => {
|
||||
document.body.classList.remove(`van-doc-theme-${oldVal}`);
|
||||
document.body.classList.add(`van-doc-theme-${newVal}`);
|
||||
document.documentElement.classList.remove(`van-doc-theme-${oldVal}`);
|
||||
document.documentElement.classList.add(`van-doc-theme-${newVal}`);
|
||||
|
||||
const { darkModeClass } = config.site;
|
||||
if (darkModeClass) {
|
||||
document.body.classList.toggle(darkModeClass, newVal === 'dark');
|
||||
document.documentElement.classList.toggle(
|
||||
darkModeClass,
|
||||
newVal === 'dark'
|
||||
);
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
@@ -43,6 +46,7 @@ export default {
|
||||
|
||||
body {
|
||||
min-width: 100vw;
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
.van-doc-theme-light {
|
||||
|
Reference in New Issue
Block a user