fix: 修改水球图编辑和颜色跟随变换

This commit is contained in:
奔跑的面条 2022-05-02 23:33:39 +08:00
parent 7b8d996ef6
commit 6ed7c130cb
5 changed files with 26 additions and 15 deletions

View File

@ -5,6 +5,7 @@ import { RequestHttpEnum } from '@/enums/httpEnum'
// 单个X数据
export const chartDataUrl = '/mock/chartData'
export const rankListUrl = '/mock/RankList'
export const numberUrl = '/mock/number'
const mockObject: MockMethod[] = [
{
@ -19,6 +20,11 @@ const mockObject: MockMethod[] = [
method: RequestHttpEnum.GET,
response: () => test.fetchRankList,
},
{
url: '/mock/number',
method: RequestHttpEnum.GET,
response: () => test.fetchNumber,
},
]
export default mockObject

View File

@ -59,4 +59,10 @@ export default {
{ name: '@name', 'value|100-900': 5 },
],
},
// 获取数字
fetchNumber: {
status: 200,
msg: '请求成功',
data: '@float(0, 0.99)',
},
}

View File

@ -50,11 +50,11 @@ export const option = {
borderDistance: 10,
itemStyle: {
borderWidth: 2,
borderColor: '#112165',
},
},
},
],
borderColor: '#112165'
}
}
}
]
}
export default class Config extends publicConfig implements CreateComponentType

View File

@ -68,22 +68,18 @@ watch(
}
)
const updateDataset = (newData: number) => {
props.chartConfig.option.series[0].data = [newData]
const updateDataset = (newData: string | number) => {
props.chartConfig.option.series[0].data = [parseFloat(`${newData}`).toFixed(2)]
option.options = props.chartConfig.option
}
updateDataset(0.5)
watch(
() => props.chartConfig.option.value,
() => props.chartConfig.option.dataset,
newData => updateDataset(newData),
{
deep: true,
immediate: true,
}
)
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, (newData: number) => {
updateDataset(newData)
})
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
</script>

View File

@ -28,6 +28,9 @@
<li>
<n-text type="info"> 表格{{ rankListUrl }} </n-text>
</li>
<li>
<n-text type="info"> 0~1数字{{ numberUrl }} </n-text>
</li>
</ul>
</n-tooltip>
</template>
@ -65,7 +68,7 @@ import { ref, toRefs } from 'vue'
import { icon } from '@/plugins'
import { SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { RequestHttpEnum } from '@/enums/httpEnum'
import { chartDataUrl, rankListUrl } from '@/api/mock'
import { chartDataUrl, rankListUrl, numberUrl } from '@/api/mock'
import { http } from '@/api/http'
import { SelectHttpType } from '../../index.d'
import { ChartDataMatchingAndShow } from '../ChartDataMatchingAndShow'