Support darkmode in other frameworks #4777
-
目前我使用vuepress默认主题时,按照element plus官方的暗黑模式配置方案,是可行的。但是切换到hope主题后,暗黑模式就失效了。 |
Beta Was this translation helpful? Give feedback.
Answered by
Mister-Hope
Mar 7, 2025
Replies: 1 comment
-
Similar things can be done with the following easily: import { useDarkMode } from '@vuepress/helper/client' // install it first!
// in setup functions:
const darkMode = useDarkMode();
onMounted(() => {
watch(darkMode, (value) => {
if (value) document.docuementElement.classList.add('dark')
else document.docuementElement.classList.remove('dark')
}, { immediate: true })
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Mister-Hope
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Similar things can be done with the following easily: