From 25864dc3b6d124f12dc1c2c61d71bb489ae5649d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=98=89=E5=A8=81?= Date: Mon, 26 Dec 2022 17:37:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=83=B6=E5=9B=8A=E6=9F=B1=E5=9B=BE?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=97=B6=E6=95=B0=E6=8D=AE=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8D=E6=9B=B4=E6=96=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Charts/Bars/CapsuleChart/index.vue | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/packages/components/Charts/Bars/CapsuleChart/index.vue b/src/packages/components/Charts/Bars/CapsuleChart/index.vue index 87971d01..c5101c21 100644 --- a/src/packages/components/Charts/Bars/CapsuleChart/index.vue +++ b/src/packages/components/Charts/Bars/CapsuleChart/index.vue @@ -111,9 +111,14 @@ watch( } ) -const calcData = (data: any) => { +const calcData = (data: any,type?:string) => { mergeConfig(props.chartConfig.option) - calcCapsuleLengthAndLabelData() + if(type=="preview"){ + calcCapsuleLengthAndLabelData(data) + }else{ + calcCapsuleLengthAndLabelData(state.mergedConfig.dataset) + } + } const mergeConfig = (data: any) => { @@ -121,8 +126,8 @@ const mergeConfig = (data: any) => { } // 数据解析 -const calcCapsuleLengthAndLabelData = () => { - const { source } = state.mergedConfig.dataset +const calcCapsuleLengthAndLabelData = (dataset:any) => { + const { source } = dataset if (!source.length) return state.capsuleItemHeight = numberSizeHandle(state.mergedConfig.itemHeight) @@ -151,7 +156,7 @@ onMounted(() => { // 预览 useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { - calcData(newData) + calcData(newData,"preview") })