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);