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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
| <script setup lang="ts">
| import { toRefs } from 'vue'
| import Icon from '@/components/icon-custom/src/Icon.vue'
|
| const props = defineProps({
| icon: {
| type: Object,
| required: false
| },
| name: {
| type: String,
| required: false
| },
| label: {
| type: String,
| required: true,
| default: ''
| },
| dragInfo: {
| type: String,
| required: true,
| default: ''
| },
| themes: {
| type: String,
| default: 'dark'
| }
| })
|
| const { icon, name, label, dragInfo, themes } = toRefs(props)
| </script>
|
| <template>
| <div class="drag-component" :class="'drag-' + themes">
| <div draggable="true" :data-id="dragInfo" class="icon-content">
| <span v-if="name" class="label-content">{{ name }}</span>
| <Icon v-if="icon"><component class="svg-icon drag-icon" :is="icon"></component></Icon>
| </div>
| <div class="label-content">
| <span>{{ label }}</span>
| </div>
| </div>
| </template>
|
| <style lang="less" scoped>
| .drag-light {
| :deep(.icon-content) {
| background-color: #f5f6f7 !important;
| }
| :deep(.label-content) {
| color: #646a73 !important;
| }
| }
| .drag-component {
| border-radius: 4px;
| width: 88px !important;
| margin-right: 12px;
| .icon-content {
| width: 88px !important;
| height: 64px !important;
| border-radius: 4px;
| &:hover {
| border: 1px solid var(--ed-color-primary);
| cursor: pointer;
| }
| display: flex;
| justify-content: center; /* 水平居中 */
| align-items: center; /* 垂直居中 */
| text-align: center;
| background-color: #1a1a1a;
| width: 100%;
| height: 60px;
| .drag-icon {
| height: 40px;
| width: 40px;
| color: var(--ed-color-primary, #3370ff);
| }
| }
| .label-content {
| color: @canvas-main-font-color;
| text-align: center;
| line-height: 20px;
| font-size: 12px;
| margin-top: 4px;
| }
| }
| </style>
|
|