2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
import{d as f,o as a,c as l,a as o,s as p,i as r,q as d,r as b,f as h,t as y,g as V,k as _,F as k,p as w,aX as v}from"./index-b7212742.js";const j={key:0,class:"relative overflow-hidden bg-white border-transparent border-1"},B=["disabled"],z={key:1,class:"flex"},C={key:0,class:"relative flex flex-col items-center justify-center mr-10 bg-white w-160 h-160 rounded-10 border-1 border-primary"},N=["disabled"],F={class:"text-12 text-primary"},$=f({__name:"base-upload",props:{modelValue:{},count:{default:1},disabled:{type:Boolean}},emits:["update:modelValue"],setup(m,{emit:g}){const i=m,n=g,u=async e=>{var s;const c=(s=e.target.files)==null?void 0:s[0],t=await v.upload({file:c});e.target.value="",i.count==1?n("update:modelValue",t):n("update:modelValue",[...i.modelValue,t])};return(e,c)=>{var t;return e.count==1?(a(),l("div",j,[o("input",{disabled:e.disabled,type:"file",class:"absolute top-0 bottom-0 left-0 right-0 opacity-0 cursor-pointer z-11 disabled:cursor-default",accept:"image/gif,image/jpg,image/jpeg,image/png",onChange:u},null,40,B),e.modelValue?(a(),p(r,{key:0,class:"absolute top-0 bottom-0 left-0 right-0 z-10 w-full h-full",src:e.modelValue},null,8,["src"])):d("",!0),e.modelValue?d("",!0):b(e.$slots,"placeholder",{key:1})])):(a(),l("div",z,[((t=e.modelValue)==null?void 0:t.length)<e.count?(a(),l("div",C,[o("input",{disabled:e.disabled,type:"file",class:"absolute top-0 bottom-0 left-0 right-0 opacity-0 cursor-pointer z-11 disabled:cursor-default",accept:"image/gif,image/jpg,image/jpeg,image/png",onChange:u},null,40,N),h(r,{class:"w-30",src:"uploadcamera.png"}),o("p",F,y(V(_)("click-upload-0")),1)])):d("",!0),(a(!0),l(k,null,w(e.modelValue,s=>(a(),p(r,{class:"mr-10 bg-white w-160 h-160 rounded-10 border-1 border-primary",src:s},null,8,["src"]))),256))]))}}});export{$ as _};
|