From 4002b5db4885f00a707b0a98570aa68f11c0b1e0 Mon Sep 17 00:00:00 2001 From: "lixuefei.1313" Date: Thu, 20 Nov 2025 16:13:05 +0800 Subject: [PATCH] fix: fix bug of vchar theme demo --- docs/assets/examples/en/theme/theme-switch.md | 13 ++----------- docs/assets/examples/zh/theme/theme-switch.md | 13 ++----------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/docs/assets/examples/en/theme/theme-switch.md b/docs/assets/examples/en/theme/theme-switch.md index 75be4357d3..45b47779f7 100644 --- a/docs/assets/examples/en/theme/theme-switch.md +++ b/docs/assets/examples/en/theme/theme-switch.md @@ -193,17 +193,8 @@ const spec = { ] }; -const getNewTheme = async () => { - const theme = // your custom theme - ( - await import('https://www.unpkg.com/@visactor/vchart-theme@latest/public/dark.json', { - assert: { type: 'json' } - }) - ).default; - return theme; -}; - -const newTheme = await getNewTheme(); +const response = await fetch('https://www.unpkg.com/@visactor/vchart-theme@latest/public/dark.json'); +const newTheme = await response.json(); // 注册主题 VChart.ThemeManager.registerTheme('user', newTheme); diff --git a/docs/assets/examples/zh/theme/theme-switch.md b/docs/assets/examples/zh/theme/theme-switch.md index c24c0ee0e6..20861ed9d6 100644 --- a/docs/assets/examples/zh/theme/theme-switch.md +++ b/docs/assets/examples/zh/theme/theme-switch.md @@ -194,17 +194,8 @@ const spec = { ] }; -const getNewTheme = async () => { - const theme = // your custom theme - ( - await import('https://www.unpkg.com/@visactor/vchart-theme@latest/public/dark.json', { - assert: { type: 'json' } - }) - ).default; - return theme; -}; - -const newTheme = await getNewTheme(); +const response = await fetch('https://www.unpkg.com/@visactor/vchart-theme@latest/public/dark.json'); +const newTheme = await response.json(); // 注册主题 VChart.ThemeManager.registerTheme('user', newTheme);