<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>
|