70 lines
1.9 KiB
Vue
Raw Normal View History

<template>
<div
class="chart-item"
v-for="(item, index) in localStorageInfo.componentList"
:class="animationsClass(item.styles.animations)"
:key="item.id"
:style="{
2022-05-03 16:24:31 +08:00
...getComponentAttrStyle(item.attr, index),
...getFilterStyle(item.styles),
...getTransformStyle(item.styles),
2022-10-08 20:49:08 +08:00
...getStatusStyle(item.status),
...getBlendModeStyle(item.styles) as any
} as any"
>
<!-- 分组 -->
<preview-render-group
v-if="item.isGroup"
2022-08-15 11:43:32 +08:00
:groupData="(item as CreateComponentGroupType)"
:groupIndex="index"
:themeSetting="themeSetting"
:themeColor="themeColor"
></preview-render-group>
<!-- 单组件 -->
<component
2022-08-15 11:43:32 +08:00
v-else
:is="item.chartConfig.chartKey"
:chartConfig="item"
:themeSetting="themeSetting"
:themeColor="themeColor"
:style="{ ...getSizeStyle(item.attr) }"
></component>
</div>
</template>
<script setup lang="ts">
import { PropType, computed } from 'vue'
import { ChartEditStorageType } from '../../index.d'
import { PreviewRenderGroup } from '../PreviewRenderGroup/index'
2022-08-15 11:43:32 +08:00
import { CreateComponentGroupType } from '@/packages/index.d'
import { chartColors } from '@/settings/chartThemes/index'
import { animationsClass, getFilterStyle, getTransformStyle, getBlendModeStyle } from '@/utils'
import { getSizeStyle, getComponentAttrStyle, getStatusStyle } from '../../utils'
const props = defineProps({
localStorageInfo: {
type: Object as PropType<ChartEditStorageType>,
required: true
}
})
// 主题色
const themeSetting = computed(() => {
const chartThemeSetting = props.localStorageInfo.editCanvasConfig.chartThemeSetting
return chartThemeSetting
})
// 配置项
const themeColor = computed(() => {
const chartThemeColor = props.localStorageInfo.editCanvasConfig.chartThemeColor
return chartColors[chartThemeColor]
})
</script>
<style lang="scss" scoped>
.chart-item {
position: absolute;
}
</style>