import{f as e,g as a,o as s,c as t,a7 as l}from"./index-d76b1e7a.js";import{_ as u}from"./uv-upload.9e6ede9e.js";import{r as o}from"./useRouter.2bdb47a0.js";import{a as r}from"./api.9246a192.js";import{_ as m}from"./_plugin-vue_export-helper.1b428a4d.js";const i=m({__name:"upload-file",props:["modelValue"],emits:["update:modelValue"],setup(m,{emit:i}){const p=e(m.modelValue),n=e=>{p.value.splice(e.index,1),i("update:modelValue",p.value)},d=async e=>{let a=[].concat(e.file),s=p.value.length;a.map((e=>{p.value.push({...e,status:"uploading",message:"上传中"})}));for(let t=0;t<a.length;t++){const e=await c(a[t].url);let l=p.value[s];p.value.splice(s,1,Object.assign(l,{status:"success",message:"",url:e})),s++}i("update:modelValue",p.value)},c=e=>new Promise(((a,s)=>{l({url:r,filePath:e,name:"file",formData:{user:"test"},success:e=>{setTimeout((()=>{a(JSON.parse(e.data).data)}),10)}})}));return(e,l)=>{const r=o(a("uv-upload"),u);return s(),t(r,{fileList:p.value,name:"1",multiple:"",maxCount:10,onAfterRead:d,onDelete:n},null,8,["fileList"])}}},[["__scopeId","data-v-be36f99c"]]);export{i as _};
