wujingjing
2024-12-10 6d5277904cd93216154d1ae8d8d452ff01725c55
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
<template>
    <div class="absolute bottom-0 left-0 right-0 top-0">
        <div class="relative flex h-full w-full flex-col">
            <Header />
            <main class="relative flex h-full w-full flex-1">
            
                <Sidebar @dragstart="handleOnDragStart"/>
                <div class="relative h-full flex-1 overflow-hidden">
                    <MainCanvas />
                </div>
            </main>
        </div>
    </div>
    <!-- <Toaster /> -->
</template>
<script setup lang="ts">
// import { PlusIcon, GhostIcon } from 'lucide-vue-next'
import { useVueFlow } from '@vue-flow/core';
import { useClipboard } from '@vueuse/core';
// import MainCanvas from '@/components/vue-flow/MainCanvas.vue';
import MainCanvas from '/@/components/vue-flow/MainCanvas.vue';
import Header from './components/Header.vue';
import Sidebar from './components/Sidebar.vue';
 
// import { Button } from '@/components/ui/button';
// import { Toaster, useToast } from '@/components/ui/toast';
 
function handleOnDragStart(event: DragEvent, nodeType: any) {
    if (event.dataTransfer) {
        event.dataTransfer.setData('application/vueflow', nodeType);
        event.dataTransfer.effectAllowed = 'move';
    }
}
 
const { toObject } = useVueFlow();
const { copy } = useClipboard();
// const { toast } = useToast();
// function handleClickGetData() {
//     copy(JSON.stringify(toObject())).then(() => {
//         toast({
//             title: 'copied success',
//         });
//     });
// }
 
// function handleClickPublishBtn() {
//     toast({
//         title: 'Save Data',
//         description: '1.valid data 2.fetch backend api to save result',
//     });
// }
</script>