File size: 1,867 Bytes
89ce340 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
<template>
<div
class="base-element"
:class="`base-element-${elementInfo.id}`"
:style="{
zIndex: elementIndex,
}"
>
<component
:is="currentElementComponent"
:elementInfo="elementInfo"
target="thumbnail"
></component>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { ElementTypes, type PPTElement } from '@/types/slides'
import BaseImageElement from '@/views/components/element/ImageElement/BaseImageElement.vue'
import BaseTextElement from '@/views/components/element/TextElement/BaseTextElement.vue'
import BaseShapeElement from '@/views/components/element/ShapeElement/BaseShapeElement.vue'
import BaseLineElement from '@/views/components/element/LineElement/BaseLineElement.vue'
import BaseChartElement from '@/views/components/element/ChartElement/BaseChartElement.vue'
import BaseTableElement from '@/views/components/element/TableElement/BaseTableElement.vue'
import BaseLatexElement from '@/views/components/element/LatexElement/BaseLatexElement.vue'
import BaseVideoElement from '@/views/components/element/VideoElement/BaseVideoElement.vue'
import BaseAudioElement from '@/views/components/element/AudioElement/BaseAudioElement.vue'
const props = defineProps<{
elementInfo: PPTElement
elementIndex: number
}>()
const currentElementComponent = computed<unknown>(() => {
const elementTypeMap = {
[ElementTypes.IMAGE]: BaseImageElement,
[ElementTypes.TEXT]: BaseTextElement,
[ElementTypes.SHAPE]: BaseShapeElement,
[ElementTypes.LINE]: BaseLineElement,
[ElementTypes.CHART]: BaseChartElement,
[ElementTypes.TABLE]: BaseTableElement,
[ElementTypes.LATEX]: BaseLatexElement,
[ElementTypes.VIDEO]: BaseVideoElement,
[ElementTypes.AUDIO]: BaseAudioElement,
}
return elementTypeMap[props.elementInfo.type] || null
})
</script> |