wujingjing
2024-12-13 d2da078b40578cf72901442c7a2b878dfc34cae5
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
<template>
    <div class="bg-white rounded-lg mt-2 py-2 px-2">
        <div
            v-for="item in VueFlowConfig.nodeStyleMap.values()"
            class="cursor-grab rounded-md bg-white py-3 px-2 hover:bg-gray-100"
            :draggable="true"
            @dragstart="handleOnDragStart($event, item.type)"
        >
            <div class="flex items-center justify-between">
                <span class="flex items-center gap-x-2">
                    <YWIcon :name="item.icon" :fontSize="item.fontSize" :color="item.color" class="rounded-lg p-1.5" :class="item.class" />
                    {{ item.title }}
                </span>
                <!-- <plus-icon class="text-primary" /> -->
            </div>
        </div>
    </div>
</template>
 
<script setup lang="ts">
import YWIcon from '/@/components/icon/index.vue';
import { VueFlowConfig } from '/@/components/vue-flow/ui/VueFlowConfig';
import { NodeType, nodeTypeMap } from '/@/components/vue-flow/vueFlowEnum';
 
const emit = defineEmits(['dragstart']);
 
const handleOnDragStart = (e, type: string) => {
    emit('dragstart', e, type);
};
 
</script>
<style scoped lang="scss"></style>