wangrong
2026-08-30 761e5c5fa871959f60e15c971c8d83f2b53d0af5
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<template>
  <div class="dynamic-shape">
    <component
      :curStyle="curStyleAdaptor"
      :scale="calScale"
      :is="findDecoration(element.innerType)"
      :color="curColor"
    ></component>
  </div>
</template>
 
<script setup lang="ts">
import { findDecoration } from '@/custom-component/de-decoration/component_details/config'
import { computed } from 'vue'
const calScale = computed(() => {
  return props.scale
})
 
const curStyleAdaptor = computed(() => {
  if (props.showPosition.includes('edit')) {
    return {
      width: parseInt(props.curStyle.width) / props.scale,
      height: parseInt(props.curStyle.height) / props.scale
    }
  } else {
    return {
      width: parseInt(props.curStyle.width),
      height: parseInt(props.curStyle.height)
    }
  }
})
 
const curColor = computed(() => {
  return [props.element.style?.color0 || null, props.element.style?.color1 || null]
})
const props = defineProps({
  curStyle: {
    type: Object
  },
  scale: {
    type: Number
  },
  showPosition: {
    required: false,
    type: String,
    default: 'preview'
  },
  element: {
    type: Object,
    default() {
      return {
        innerType: null
      }
    }
  }
})
</script>
 
<style lang="less" scoped>
.dynamic-shape {
  width: 100%;
  height: 100%;
}
</style>