wujingjing
2024-12-11 2144fb07b53812f565b2801f99e69cee9b28cab3
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
<template>
    <div class="h-14 flex justify-between px-2 border border-solid border-x-0 border-t-0 border-gray-300">
        <div class="flex-items-center">
            <span class="ywifont ywicon-pre p-1 bg-white rounded-lg mr-2"></span>
 
            <!-- <img src="@/assets/logo.png" alt="logo" class="h-8 w-8"/> -->
            <div>
                <span class="font-bold">测试</span>
            </div>
        </div>
        <div class="flex-items-center">
            <!-- <el-button>运行</el-button>
            <el-button>保存</el-button>
            <el-button type="primary">运行</el-button> -->
            <el-dropdown @command="handleCommand">
                <el-button style="margin-left: 8px; width: 34px">
                    <el-icon class="el-icon--center">
                        <more-filled />
                    </el-icon>
                </el-button>
                <template #dropdown>
                    <el-dropdown-menu>
                        <el-dropdown-item command="export">导出</el-dropdown-item>
                        <el-dropdown-item command="import">导入</el-dropdown-item>
                    </el-dropdown-menu>
                </template>
            </el-dropdown>
        </div>
    </div>
</template>
 
<script setup lang="ts">
import { useVueFlow } from '@vue-flow/core';
import JSONFormat from 'json-format';
import { downloadJSON } from '/@/utils/util';
 
const emit = defineEmits(['export']);
const { toObject } = useVueFlow();
 
const handleCommand = (command: string | number | object) => {
    const obj = toObject();
 
    if (command === 'export') {
        const jsonStr = obj ? JSONFormat(obj) : '';
        downloadJSON(jsonStr, 'flow');
    } else {
    }
};
</script>
<style scoped lang="scss"></style>