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