diff --git a/packages/sfc-playground/index.html b/packages/sfc-playground/index.html index 26431e134..29e8d6e97 100644 --- a/packages/sfc-playground/index.html +++ b/packages/sfc-playground/index.html @@ -8,14 +8,14 @@ Vue SFC Playground diff --git a/packages/sfc-playground/package.json b/packages/sfc-playground/package.json index b6bfb9b79..76e6a014e 100644 --- a/packages/sfc-playground/package.json +++ b/packages/sfc-playground/package.json @@ -12,7 +12,7 @@ "vite": "^4.3.9" }, "dependencies": { - "@vue/repl": "^2.3.0", + "@vue/repl": "^2.4.0", "file-saver": "^2.0.5", "jszip": "^3.6.0", "vue": "workspace:*" diff --git a/packages/sfc-playground/src/App.vue b/packages/sfc-playground/src/App.vue index 3c850fec4..f9b77f47e 100644 --- a/packages/sfc-playground/src/App.vue +++ b/packages/sfc-playground/src/App.vue @@ -2,7 +2,7 @@ import Header from './Header.vue' import { Repl, ReplStore, SFCOptions } from '@vue/repl' import Monaco from '@vue/repl/monaco-editor' -import { ref, watchEffect } from 'vue' +import { ref, watchEffect, onMounted } from 'vue' const setVH = () => { document.documentElement.style.setProperty('--vh', window.innerHeight + `px`) @@ -72,6 +72,15 @@ function toggleSSR() { useSSRMode.value = !useSSRMode.value store.setFiles(store.getFiles()) } + +const theme = ref('dark') +function toggleTheme(isDark: boolean) { + theme.value = isDark ? 'dark' : 'light' +} +onMounted(() => { + const cls = document.documentElement.classList + toggleTheme(cls.contains('dark')) +})