mirror of
https://gitee.com/dromara/go-view.git
synced 2024-12-05 21:28:43 +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)
|
||||
let fetchInterval: any = 0
|
||||
|
||||
watchEffect(() => {
|
||||
isPreview() && watchEffect(() => {
|
||||
clearInterval(fetchInterval)
|
||||
|
||||
const chartEditStore = useChartEditStore()
|
||||
@ -36,9 +36,8 @@ export const useChartDataFetch = (chartConfig: CreateComponentType) => {
|
||||
const res = await http(requestHttpType.value)(completePath || '', {})
|
||||
if (res.data) {
|
||||
nextTick(() => {
|
||||
chartConfig.option.dataset = res.data as any
|
||||
if(isPreview() && vChartRef.value) {
|
||||
vChartRef.value.setOption(chartConfig.option)
|
||||
if(vChartRef.value) {
|
||||
vChartRef.value.setOption({dataset: res.data})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user