<script lang="ts" setup>
import { ref } from 'vue'
import FilePicker from '@/components/FilePicker.ce.vue'
const filePickerType = ref<'file' | 'directory' | 'openFile' | 'openDir' | 'saveAs'>('file')
const filepickerRef = ref()
const changeType = (_type: 'file' | 'directory' | 'openFile' | 'openDir' | 'saveAs') => {
  filepickerRef.value.init()
  filepickerRef.value.open()
  filePickerType.value = _type
}
const submit = (e: any) => {
  console.log('submitxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', e)
}
</script>
<template>
  <button @click="changeType('file')">文件</button>
  <button @click="changeType('directory')">文件夹</button>
  <button @click="changeType('openFile')">打开文件</button>
  <button @click="changeType('openDir')">打开文件夹</button>
  <button @click="changeType('saveAs')">保存文件</button>

  <FilePicker ref="filepickerRef" box-id="monkeyking" :type="filePickerType" @submit="submit" />
</template>
