mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
fix: 设置图表只在预览页面进行轮询请求
This commit is contained in:
parent
66373a427b
commit
19ed2fec19
@ -14,7 +14,7 @@ export const useChartDataFetch = (chartConfig: CreateComponentType) => {
|
|||||||
const vChartRef = ref<typeof VChart | null>(null)
|
const vChartRef = ref<typeof VChart | null>(null)
|
||||||
let fetchInterval: any = 0
|
let fetchInterval: any = 0
|
||||||
|
|
||||||
watchEffect(() => {
|
isPreview() && watchEffect(() => {
|
||||||
clearInterval(fetchInterval)
|
clearInterval(fetchInterval)
|
||||||
|
|
||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
@ -36,9 +36,8 @@ export const useChartDataFetch = (chartConfig: CreateComponentType) => {
|
|||||||
const res = await http(requestHttpType.value)(completePath || '', {})
|
const res = await http(requestHttpType.value)(completePath || '', {})
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
chartConfig.option.dataset = res.data as any
|
if(vChartRef.value) {
|
||||||
if(isPreview() && vChartRef.value) {
|
vChartRef.value.setOption({dataset: res.data})
|
||||||
vChartRef.value.setOption(chartConfig.option)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user