Skip to content

Commit

Permalink
fix: echarts resize error (#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
lcosmos authored Oct 30, 2023
1 parent cc84c85 commit 03e9596
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import * as echarts from 'echarts/core';
import { onMounted, onUnmounted, Ref, ref } from 'vue';
import { onMounted, onUnmounted, Ref, ref, ShallowRef, shallowRef } from 'vue';

/**
* eChart hook
* @param domId
* @param chart
*/
export const useChart = (domId: string): Ref<echarts.ECharts> => {
export const useChart = (domId: string): ShallowRef<echarts.ECharts> => {
let chartContainer: HTMLCanvasElement;
const selfChart = ref<echarts.ECharts | any>();
const selfChart = shallowRef<echarts.ECharts | any>();
const updateContainer = () => {
// TODO resize 报错,响应式的问题,待处理
selfChart.value.resize({
width: chartContainer.clientWidth,
height: chartContainer.clientHeight,
Expand Down

0 comments on commit 03e9596

Please sign in to comment.