mirror of
https://github.com/Tencent/tdesign-vue-next-starter.git
synced 2024-12-22 21:26:33 +08:00
fix: echarts resize error (#622)
This commit is contained in:
parent
cc84c85013
commit
03e959696e
|
@ -1,16 +1,14 @@
|
||||||
import * as echarts from 'echarts/core';
|
import * as echarts from 'echarts/core';
|
||||||
import { onMounted, onUnmounted, Ref, ref } from 'vue';
|
import { onMounted, onUnmounted, Ref, ref, ShallowRef, shallowRef } from 'vue';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* eChart hook
|
* eChart hook
|
||||||
* @param domId
|
* @param domId
|
||||||
* @param chart
|
|
||||||
*/
|
*/
|
||||||
export const useChart = (domId: string): Ref<echarts.ECharts> => {
|
export const useChart = (domId: string): ShallowRef<echarts.ECharts> => {
|
||||||
let chartContainer: HTMLCanvasElement;
|
let chartContainer: HTMLCanvasElement;
|
||||||
const selfChart = ref<echarts.ECharts | any>();
|
const selfChart = shallowRef<echarts.ECharts | any>();
|
||||||
const updateContainer = () => {
|
const updateContainer = () => {
|
||||||
// TODO resize 报错,响应式的问题,待处理
|
|
||||||
selfChart.value.resize({
|
selfChart.value.resize({
|
||||||
width: chartContainer.clientWidth,
|
width: chartContainer.clientWidth,
|
||||||
height: chartContainer.clientHeight,
|
height: chartContainer.clientHeight,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user