mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增数据池 hook
This commit is contained in:
+1
-1
@@ -125,7 +125,7 @@ const sendHandle = async () => {
|
||||
if (!targetData.value?.request) return
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.requestGlobalConfig))
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
|
||||
loading.value = false
|
||||
if (res) {
|
||||
if(!res?.data && !targetData.value.filter) window['$message'].warning('您的数据不符合默认格式,请配置过滤器!')
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ const sourceData = ref<any>('')
|
||||
// 动态获取数据
|
||||
const fetchTargetData = async () => {
|
||||
try {
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.requestGlobalConfig))
|
||||
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
|
||||
if (res) {
|
||||
sourceData.value = res
|
||||
return
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
...getTransformStyle(item.styles),
|
||||
...getStatusStyle(item.status),
|
||||
...getBlendModeStyle(item.styles) as any
|
||||
} as any"
|
||||
}"
|
||||
>
|
||||
<!-- 分组 -->
|
||||
<preview-render-group
|
||||
@@ -36,7 +36,8 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { PropType, computed, onMounted } from 'vue'
|
||||
import { useChartDataPondFetch } from '@/hooks'
|
||||
import { ChartEditStorageType } from '../../index.d'
|
||||
import { PreviewRenderGroup } from '../PreviewRenderGroup/index'
|
||||
import { CreateComponentGroupType } from '@/packages/index.d'
|
||||
@@ -45,6 +46,9 @@ import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle }
|
||||
import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
|
||||
import { useLifeHandler } from '@/hooks'
|
||||
|
||||
// 初始化数据池
|
||||
const { initDataPond } = useChartDataPondFetch()
|
||||
|
||||
const props = defineProps({
|
||||
localStorageInfo: {
|
||||
type: Object as PropType<ChartEditStorageType>,
|
||||
@@ -63,6 +67,11 @@ const themeColor = computed(() => {
|
||||
const chartThemeColor = props.localStorageInfo.editCanvasConfig.chartThemeColor
|
||||
return chartColors[chartThemeColor]
|
||||
})
|
||||
|
||||
// 组件渲染结束初始化数据池
|
||||
onMounted(() => {
|
||||
initDataPond(props.localStorageInfo.requestGlobalConfig)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user