From e3f69f32797d328f3d0f28f4055deec282eaca7e Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 2 Jan 2024 16:39:24 +0800 Subject: [PATCH 1/2] feat: apply theme to preview --- src/output/Preview.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/output/Preview.vue b/src/output/Preview.vue index d69f08a1..6e511409 100644 --- a/src/output/Preview.vue +++ b/src/output/Preview.vue @@ -20,6 +20,7 @@ const props = defineProps<{ show: boolean; ssr: boolean }>() const store = inject('store') as Store const clearConsole = inject('clear-console') as Ref +const theme = inject('theme') as Ref<'dark' | 'light'> const previewOptions = inject('preview-options') as Props['previewOptions'] @@ -85,6 +86,7 @@ function createSandbox() { importMap.imports.vue = store.state.vueRuntimeURL } const sandboxSrc = srcdoc + .replace(//, ``) .replace(//, JSON.stringify(importMap)) .replace( //, @@ -279,7 +281,12 @@ defineExpose({ reload }) @@ -292,4 +299,7 @@ defineExpose({ reload }) border: none; background-color: #fff; } +.iframe-container.dark :deep(iframe) { + background-color: #1e1e1e; +} From ce0c504180a9f82bac3d751a66d0865a02d08191 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Tue, 2 Jan 2024 16:59:32 +0800 Subject: [PATCH 2/2] chore: update --- src/output/Preview.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output/Preview.vue b/src/output/Preview.vue index 6e511409..2be91663 100644 --- a/src/output/Preview.vue +++ b/src/output/Preview.vue @@ -86,7 +86,7 @@ function createSandbox() { importMap.imports.vue = store.state.vueRuntimeURL } const sandboxSrc = srcdoc - .replace(//, ``) + .replace(//, ``) .replace(//, JSON.stringify(importMap)) .replace( //,