feat:新增预览页面位置图表位置渲染功能

This commit is contained in:
mtruning
2022-03-06 16:54:48 +08:00
parent 41798a2ec6
commit 33174f8208
8 changed files with 107 additions and 24 deletions
@@ -0,0 +1,3 @@
import RenderList from './index.vue'
export { RenderList }
@@ -0,0 +1,48 @@
<template>
<div
class="chart-item"
v-for="(item, index) in localStorageInfo.componentList"
:key="item.id"
:style="{ ...useComponentStyle(item.attr, index), ...useSizeStyle(item.attr) }"
>
<component
:is="item.key"
:chartConfig="item"
:themeSetting="themeSetting"
:themeColor="themeColor"
/>
</div>
</template>
<script setup lang="ts">
import { PropType, computed } from 'vue'
import { ChartEditStorageType } from '../../index.d'
import { chartColors } from '@/settings/chartThemes/index'
import { useSizeStyle, useComponentStyle } from '../../hooks/useStyle.hook'
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>