mirror of
https://gitee.com/dromara/go-view.git
synced 2025-06-30 00:29:16 +08:00
fix: 打包时优化代码
This commit is contained in:
parent
c615c38eb9
commit
0de080e710
@ -3,7 +3,7 @@ import { setOption } from "@/packages/public";
|
||||
import { ref, toRefs, watch } from "vue";
|
||||
import { CreateComponentType, ChartFrameEnum } from '@/packages/index.d'
|
||||
import { useChartEditStore } from "@/store/modules/chartEditStore/chartEditStore";
|
||||
import { CurrentSourceEnum } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { CurrentSourceEnum, resultType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
import { intervalUnitHandle, newFunctionHandle, isPreview } from "@/utils";
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { handlePointHistory } from './commonDataComponents/usePointHistoryRes'
|
||||
@ -61,13 +61,12 @@ export const useChartCommonData = (
|
||||
}
|
||||
}
|
||||
else if(SingleDataArr.some(_ => _ === currentSource)) { // 单个值的处理
|
||||
if(targetComponent.commonData[currentSource]?.result) {
|
||||
stopWatch = true
|
||||
targetComponent.commonData[currentSource].result = dataset
|
||||
setTimeout(() => {
|
||||
stopWatch = false
|
||||
}, 500)
|
||||
}
|
||||
const targetObj = targetComponent.commonData[currentSource] as { result: resultType }
|
||||
stopWatch = true
|
||||
targetObj.result = dataset
|
||||
setTimeout(() => {
|
||||
stopWatch = false
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,6 +134,7 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const config = computed(() => {
|
||||
return props.optionData
|
||||
})
|
||||
// 使用类型断言来告诉 TypeScript 编译器 title 总是存在
|
||||
return props.optionData as GlobalThemeJsonType & { title: NonNullable<GlobalThemeJsonType['title']> };
|
||||
});
|
||||
</script>
|
||||
|
@ -14,6 +14,8 @@ import config, { includes } from './config'
|
||||
import { useChartCommonData, useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, TitleComponent } from 'echarts/components'
|
||||
import { resultType } from '@/store/modules/chartEditStore/chartEditStore.d'
|
||||
|
||||
|
||||
const props = defineProps({
|
||||
themeSetting: {
|
||||
@ -89,7 +91,7 @@ watch(
|
||||
() => props.chartConfig.commonData,
|
||||
newData => {
|
||||
try {
|
||||
const data = newData[newData.currentSource]
|
||||
const data = newData[newData.currentSource] as Object & { result: resultType }
|
||||
dataHandle(data.result)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
@ -102,7 +104,7 @@ watch(
|
||||
)
|
||||
watch(() => props.chartConfig.option.titleContrl, (v) => {
|
||||
const commonData = props.chartConfig.commonData
|
||||
const data = commonData[commonData.currentSource]
|
||||
const data = commonData[commonData.currentSource] as Object & { result: resultType }
|
||||
dataHandle(data.result)
|
||||
}, {
|
||||
immediate: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user