mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 修改图表数据接口的hooks
This commit is contained in:
+3
-1
@@ -1,3 +1,5 @@
|
||||
export * from '@/hooks/useTheme.hook'
|
||||
export * from '@/hooks/usePreviewScale.hook'
|
||||
export * from '@/hooks/useCode.hook'
|
||||
export * from '@/hooks/useCode.hook'
|
||||
export * from '@/hooks/useChartDataFetch.hook'
|
||||
export * from '@/hooks/useChartTheme.hook'
|
||||
@@ -6,11 +6,13 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore
|
||||
import { RequestDataTypeEnum } from '@/enums/httpEnum'
|
||||
import { isPreview } from '@/utils'
|
||||
|
||||
type ChartEditStoreType = typeof useChartEditStore
|
||||
|
||||
/**
|
||||
* 图表的 setdata 数据监听与更改
|
||||
* @param chartConfig
|
||||
*/
|
||||
export const useChartDataFetch = (chartConfig: CreateComponentType) => {
|
||||
export const useChartDataFetch = (chartConfig: CreateComponentType, useChartEditStore: ChartEditStoreType) => {
|
||||
const vChartRef = ref<typeof VChart | null>(null)
|
||||
let fetchInterval: any = 0
|
||||
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import { onMounted, ref, watch } from 'vue'
|
||||
import cloneDeep from 'lodash/cloneDeep'
|
||||
import merge from 'lodash/merge'
|
||||
|
||||
/**
|
||||
* border-hook
|
||||
* @param props
|
||||
* @param _defaultColor 默认颜色
|
||||
* @param afterResizeFun resize容器之后执行函数
|
||||
*/
|
||||
export const useBorderBox = (props: any, _defaultColor: string[]) => {
|
||||
const mergedColor = ref([])
|
||||
const defaultColor = ref(_defaultColor)
|
||||
|
||||
function mergeColor() {
|
||||
mergedColor.value = merge(cloneDeep(defaultColor.value), props.color || [])
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.color, props.reverse],
|
||||
() => {
|
||||
mergeColor()
|
||||
}
|
||||
)
|
||||
onMounted(() => {
|
||||
mergeColor()
|
||||
})
|
||||
|
||||
return {
|
||||
defaultColor,
|
||||
mergeColor,
|
||||
mergedColor
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user