mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
perf: 修改数据展示为动态获取
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
fontSize: `${indicatorTextSize}px`
|
||||
}"
|
||||
>
|
||||
{{option.dataset}} {{unit}}
|
||||
{{ option.dataset }} {{ unit }}
|
||||
</n-text>
|
||||
</n-progress>
|
||||
</template>
|
||||
@@ -24,7 +24,8 @@
|
||||
import { PropType, toRefs, watch, shallowReactive } from 'vue'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import config, { option as configOption } from './config'
|
||||
import config, { option as configOption } from './config'
|
||||
import { toNumber } from '@/utils'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
@@ -57,11 +58,11 @@ const option = shallowReactive({
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: any) => {
|
||||
option.dataset = newData
|
||||
option.dataset = toNumber(newData, 2)
|
||||
}
|
||||
)
|
||||
// 预览更新
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: number) => {
|
||||
option.dataset = newData
|
||||
option.dataset = toNumber(newData, 2)
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -10,7 +10,7 @@ import 'echarts-liquidfill/src/liquidFill.js'
|
||||
import { CanvasRenderer } from 'echarts/renderers'
|
||||
import { GridComponent } from 'echarts/components'
|
||||
import config from './config'
|
||||
import { isPreview } from '@/utils'
|
||||
import { isPreview, isString } from '@/utils'
|
||||
import { chartColorsSearch, defaultTheme } from '@/settings/chartThemes/index'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
@@ -66,7 +66,8 @@ watch(
|
||||
)
|
||||
|
||||
// 数据处理
|
||||
const dataHandle = (newData: number) => {
|
||||
const dataHandle = (newData: number | string) => {
|
||||
newData = isString(newData) ? parseFloat(newData) : newData
|
||||
return parseFloat(newData.toFixed(2))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user