Skip to content

Commit

Permalink
fix(echarts): theme setting supported
Browse files Browse the repository at this point in the history
修复useECharts的theme参数不起作用的问题

fixed: #1095
  • Loading branch information
mynetfan committed Aug 18, 2021
1 parent e15b4f1 commit 93812f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

### 🐛 Bug Fixes

- **其它** 修复部分封装组件在使用插槽时报错的问题
- **其它**
- 修复部分封装组件在使用插槽时报错的问题
- 修复`useECharts``theme`参数不起作用的问题

## 2.7.1(2021-08-16)

Expand Down
8 changes: 6 additions & 2 deletions src/hooks/web/useECharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ import { useRootSetting } from '/@/hooks/setting/useRootSetting';

export function useECharts(
elRef: Ref<HTMLDivElement>,
theme: 'light' | 'dark' | 'default' = 'light'
theme: 'light' | 'dark' | 'default' = 'default'
) {
const { getDarkMode } = useRootSetting();
const { getDarkMode: getSysDarkMode } = useRootSetting();

const getDarkMode = computed(() => {
return theme === 'default' ? getSysDarkMode.value : theme;
});
let chartInstance: echarts.ECharts | null = null;
let resizeFn: Fn = resize;
const cacheOptions = ref({}) as Ref<EChartsOption>;
Expand Down

0 comments on commit 93812f7

Please sign in to comment.