fix: attach css variables to :root element (#11026)

This commit is contained in:
neverland
2022-09-11 09:11:53 +08:00
committed by GitHub
parent b6f2eb3e2a
commit 34360abd3b
79 changed files with 98 additions and 94 deletions
@@ -138,8 +138,8 @@ export default {
currentTheme: {
handler(newVal, oldVal) {
window.localStorage.setItem('vantTheme', newVal);
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}`);
syncThemeToChild(newVal);
},
immediate: true,