Commit 93812f734ec85529aa27fc3100a2eaef8c7a6df5

Authored by 无木
1 parent e15b4f14

fix(echarts): theme setting supported

修复useECharts的theme参数不起作用的问题

fixed: #1095
CHANGELOG.zh_CN.md
... ... @@ -4,7 +4,9 @@
4 4  
5 5 ### 🐛 Bug Fixes
6 6  
7   -- **其它** 修复部分封装组件在使用插槽时报错的问题
  7 +- **其它**
  8 + - 修复部分封装组件在使用插槽时报错的问题
  9 + - 修复`useECharts`的`theme`参数不起作用的问题
8 10  
9 11 ## 2.7.1(2021-08-16)
10 12  
... ...
src/hooks/web/useECharts.ts
... ... @@ -11,9 +11,13 @@ import { useRootSetting } from '/@/hooks/setting/useRootSetting';
11 11  
12 12 export function useECharts(
13 13 elRef: Ref<HTMLDivElement>,
14   - theme: 'light' | 'dark' | 'default' = 'light'
  14 + theme: 'light' | 'dark' | 'default' = 'default'
15 15 ) {
16   - const { getDarkMode } = useRootSetting();
  16 + const { getDarkMode: getSysDarkMode } = useRootSetting();
  17 +
  18 + const getDarkMode = computed(() => {
  19 + return theme === 'default' ? getSysDarkMode.value : theme;
  20 + });
17 21 let chartInstance: echarts.ECharts | null = null;
18 22 let resizeFn: Fn = resize;
19 23 const cacheOptions = ref({}) as Ref<EChartsOption>;
... ...