wangrong
2026-08-30 4c949c0dc9bcae785c281c9d8125295f09810b15
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
65
66
67
68
69
70
71
72
73
<script setup lang="ts">
import dvRichText from '@/assets/svg/dv-richText.svg'
import dvScrollText from '@/assets/svg/dv-scroll-text.svg'
import { toRefs } from 'vue'
import eventBus from '@/utils/eventBus'
import DragComponent from '@/custom-component/component-group/DragComponent.vue'
import { commonHandleDragEnd, commonHandleDragStart } from '@/utils/canvasUtils'
import { useI18n } from '@/hooks/web/useI18n'
const { t } = useI18n()
const props = defineProps({
  propValue: {
    type: Array,
    default: () => []
  },
  dvModel: {
    type: String,
    default: 'dataV'
  },
  element: {
    type: Object,
    default() {
      return {
        propValue: null
      }
    }
  },
  themes: {
    type: String,
    default: 'dark'
  }
})
 
const { dvModel, themes } = toRefs(props)
 
const handleDragStart = e => {
  commonHandleDragStart(e, dvModel.value)
}
 
const handleDragEnd = e => {
  commonHandleDragEnd(e, dvModel.value)
}
 
const newComponent = (componentName, innerType) => {
  eventBus.emit('handleNew', { componentName: componentName, innerType: innerType })
}
</script>
 
<template>
  <div class="group" @dragstart="handleDragStart" @dragend="handleDragEnd">
    <drag-component
      :themes="themes"
      :icon="dvRichText"
      :label="t('visualization.rich_text')"
      drag-info="UserView&rich-text"
      v-on:click="newComponent('UserView', 'rich-text')"
    ></drag-component>
    <drag-component
      v-if="dvModel === 'dataV'"
      :themes="themes"
      :icon="dvScrollText"
      :label="t('visualization.scroll_text')"
      drag-info="ScrollText&ScrollText"
      v-on:click="newComponent('ScrollText', 'ScrollText')"
    ></drag-component>
  </div>
</template>
 
<style lang="less" scoped>
.group {
  padding: 12px 8px;
  display: inline-flex;
}
</style>