index.vue 788 字节
<template>
  <el-button @click="create">添加航线</el-button>
  <el-button @click="update">编辑航线</el-button>

  <air-route ref="airRouteRef" @save="save"/>
</template>

<script setup lang="ts">
import axios from "axios";
import {nextTick, ref} from "vue";
import AirRoute from "@/components/air-route/air-route.vue";

const airRouteRef = ref()

async function update() {
  let res: { data: string } = await axios.get("/public/air-route/waylines.wpml")
  let file = new File([res.data], "waylines.wpml")
  await nextTick()
  airRouteRef.value.open({title: '编辑测试', file: file})
}

async function create() {
  await nextTick()
  airRouteRef.value.open({title: '新建测试'})
}

function save(result) {
  console.log(result)
}
update()
</script>

<style scoped>

</style>