feat: 新增组件更新单独设置功能

This commit is contained in:
奔跑的面条
2022-07-08 17:53:52 +08:00
parent 88abcf8a4a
commit 801f6e8d18
5 changed files with 29 additions and 13 deletions
+9 -4
View File
@@ -9,7 +9,6 @@ import { isPreview, newFunctionHandle } from '@/utils'
// 获取类型
type ChartEditStoreType = typeof useChartEditStore
/**
* setdata 数据监听与更改
* @param targetComponent
@@ -30,7 +29,12 @@ export const useChartDataFetch = (
// 组件类型
const { chartFrame } = targetComponent.chartConfig
// 请求配置
const { requestDataType, requestHttpType, requestUrl } = toRefs(targetComponent.request)
const {
requestDataType,
requestHttpType,
requestUrl,
requestInterval: targetInterval
} = toRefs(targetComponent.request)
// 非请求类型
if (requestDataType.value !== RequestDataTypeEnum.AJAX) return
// 处理地址
@@ -65,12 +69,13 @@ export const useChartDataFetch = (
// 立即调用
fetchFn()
// 开启定时
fetchInterval = setInterval(fetchFn, requestInterval.value * 1000)
const time = targetInterval && targetInterval.value ? targetInterval.value : requestInterval.value
fetchInterval = setInterval(fetchFn, time * 1000)
}
}
isPreview() && requestIntervalFn()
return { vChartRef }
}