From 7e9dc0f3b1f2c488664ccfa22cdf21ba19926158 Mon Sep 17 00:00:00 2001 From: btea <2356281422@qq.com> Date: Sun, 7 Jan 2024 22:22:58 +0800 Subject: [PATCH] feat: add theme as classname to sandbox (#203) --- src/output/Preview.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/output/Preview.vue b/src/output/Preview.vue index 50176db5..bd257598 100644 --- a/src/output/Preview.vue +++ b/src/output/Preview.vue @@ -51,6 +51,17 @@ watch( // reset sandbox when version changes watch(() => store.state.resetFlip, createSandbox) +// reset theme +watch( + () => theme.value, + (value) => { + const html = sandbox.contentDocument?.documentElement + if (html) { + html.className = value + } + } +) + onUnmounted(() => { proxy.destroy() stopUpdateWatcher && stopUpdateWatcher()