From 8ea99f0c4f14f832d5fc091727aa73256b159fc6 Mon Sep 17 00:00:00 2001 From: Lo Date: Thu, 17 Apr 2025 23:18:26 +0800 Subject: [PATCH] docs(color-mode): fix computed setter logic in `ColorModeButton.vue` example (#3903) --- docs/content/1.getting-started/6.color-mode/1.nuxt.md | 4 ++-- playground/app/app.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/content/1.getting-started/6.color-mode/1.nuxt.md b/docs/content/1.getting-started/6.color-mode/1.nuxt.md index e4a07514..35e6d68d 100644 --- a/docs/content/1.getting-started/6.color-mode/1.nuxt.md +++ b/docs/content/1.getting-started/6.color-mode/1.nuxt.md @@ -26,8 +26,8 @@ const isDark = computed({ get() { return colorMode.value === 'dark' }, - set() { - colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark' + set(_isDark) { + colorMode.preference = _isDark ? 'dark' : 'light' } }) diff --git a/playground/app/app.vue b/playground/app/app.vue index 5557d7e1..b73b4437 100644 --- a/playground/app/app.vue +++ b/playground/app/app.vue @@ -10,8 +10,8 @@ const isDark = computed({ get() { return colorMode.value === 'dark' }, - set() { - colorMode.preference = colorMode.value === 'dark' ? 'light' : 'dark' + set(_isDark) { + colorMode.preference = _isDark ? 'dark' : 'light' } })