!265 fix: 修复已保存的饼图数据radius被watch修改为默认值bug

Merge pull request !265 from xihai777/master-fetch-dev
This commit is contained in:
奔跑的面条 2025-04-28 07:31:24 +00:00 committed by Gitee
commit 415b3d6f7d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -12,7 +12,7 @@
</template>
<script setup lang="ts">
import { computed, PropType, onMounted, watch } from 'vue'
import { computed, PropType, onMounted, watch, ref } from 'vue'
import VChart from 'vue-echarts'
import { useCanvasInitOptions } from '@/hooks/useCanvasInitOptions.hook'
import { use } from 'echarts/core'
@ -26,6 +26,8 @@ import { isPreview } from '@/utils'
import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent } from 'echarts/components'
import dataJson from './data.json'
const isInit = ref<boolean>(false)
const props = defineProps({
themeSetting: {
type: Object,
@ -103,6 +105,10 @@ watch(
() => props.chartConfig.option.type,
newData => {
try {
//
if (!isInit.value) {
isInit.value = true
} else {
if (newData === 'nomal') {
props.chartConfig.option.series[0].radius = '70%'
props.chartConfig.option.series[0].roseType = false
@ -113,6 +119,7 @@ watch(
props.chartConfig.option.series[0].radius = '70%'
props.chartConfig.option.series[0].roseType = true
}
}
} catch (error) {
console.log(error)
}