!120 胶囊柱图展示数据不刷新

Merge pull request !120 from daidai/dev
This commit is contained in:
奔跑的面条 2022-12-31 12:18:50 +00:00 committed by Gitee
commit 5261a09381

View File

@ -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")
})
</script>