feat: 修改组件展示,支持单个组件数据编辑

This commit is contained in:
MTrun
2022-02-24 17:23:20 +08:00
parent 2bdc489827
commit 14010cce8f
17 changed files with 219 additions and 175 deletions
@@ -1,10 +1,31 @@
<template>
<div class="go-chart-content-details">
设置
<GlobalSetting
v-if="targetData"
:data="targetData.option"
:in-chart="true"
/>
</div>
</template>
<script setup></script>
<script setup lang="ts">
import { computed } from 'vue'
import { loadAsyncComponent } from '@/utils'
import { useChartEditStoreStore } from '@/store/modules/chartEditStore/chartEditStore'
import { GlobalSetting } from '@/components/ChartItemSetting/index'
import { CreateComponentType } from '@/packages/index.d'
const GlobalSettingCom = loadAsyncComponent(() =>
import('@/components/ChartItemSetting/index')
)
const chartEditStoreStore = useChartEditStoreStore()
const targetData = computed(() => {
const list = chartEditStoreStore.getComponentList
const targetIndex = chartEditStoreStore.fetchTargetIndex()
return list[targetIndex]
})
</script>
<style lang="scss" scoped>
@include go('chart-content-details') {
@@ -94,7 +94,7 @@ const labelHandle = (e: HistoryItemType) => {
return historyActionTypeName[HistoryTargetTypeEnum.CANVAS]
}
return `${historyActionTypeName[e.actionType]} - ${
(e.historyData as CreateComponentType).chartData.title
(e.historyData as CreateComponentType).chartConfig.title
}`
}
+1 -1
View File
@@ -29,7 +29,7 @@
<component
class="edit-content-chart"
:is="item.key"
:chartData="item"
:chartConfig="item"
:themeSetting="themeSetting"
:themeColor="themeColor"
:style="useSizeStyle(item.attr)"
@@ -39,7 +39,7 @@ const props = defineProps({
}
})
const { image, title } = toRefs(props.componentData.chartData)
const { image, title } = toRefs(props.componentData.chartConfig)
// 计算当前选中目标
const select = computed(() => {