1 |
- import{_ as b,d as F,w as l,bH as h,aO as B,r as c,o as j,G as C,C as p,l as E,M as x,b as I,aY as i,bI as U,bJ as k}from"./index.42bf163d.js";const w=I("div",{class:"el-upload__tip"},"\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247",-1),y=F({__name:"img-upload",emits:["change"],setup(D,{emit:r}){const d=["image/png","image/jpg","image/bmp","image/jpeg"],t=l([]),o=l([]),m=h(),g=B(),_=({type:a,size:e})=>{if(!d.includes(a))return i.error("\u8BF7\u4E0A\u4F20jpg.png.bmp.jpeg\u7C7B\u578B\u56FE\u7247"),!1;if(e/1024/1024>1)return i.error("\u56FE\u7247\u5927\u5C0F\u8D85\u8FC71M"),!1},f=async({file:a})=>{const e=new FormData;e.append("img",a),e.append("token",m.token);const{message:s,code:n,data:u}=await U(e);g({message:s,code:n,handler:()=>{o.value.push(k+"/"+u[0].url),r("change",o.value.join(","))}})},v=a=>{const e=t.value.findIndex(({uid:s})=>s===a.uid);return o.value.splice(e,1),r("change",o.value.join(",")),!0};return(a,e)=>{const s=c("el-button"),n=c("el-upload");return j(),C(n,{"file-list":t.value,"onUpdate:fileList":e[0]||(e[0]=u=>t.value=u),"before-upload":_,"http-request":f,"before-remove":v,multiple:""},{tip:p(()=>[w]),default:p(()=>[E(s,{type:"primary"},{default:p(()=>[x("\u4E0A\u4F20\u56FE\u7247")]),_:1})]),_:1},8,["file-list"])}}});var A=b(y,[["__file","C:/Users/63107/Desktop/projects/accout-vue3-ui/src/views/InvoiceSales/refund/components/approval-process/img-upload.vue"]]);export{A as default};
|