2 lines
3.6 KiB
JavaScript
2 lines
3.6 KiB
JavaScript
import{d as L,q as S,n as h,s as P,h as o,c as n,a as l,x as v,u as i,e as s,R as g,I as j,w as $,t as B,N,F as y,G as R,B as E,ax as D,V as Z,aO as q,_ as G}from"./index-4dcc0234.js";/* empty css */import{_ as O}from"./index.vue_vue_type_style_index_0_lang-5c6c00d9.js";import{_ as A}from"./index.vue_vue_type_script_setup_true_lang-9285296e.js";/* empty css */const H={class:"flex flex-wrap"},J={key:0,class:"w-full h-full relative"},K={class:"w-full h-full flex items-center justify-center"},M={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60 operation"},Q={class:"w-full h-full flex items-center justify-center flex-col"},U={class:"leading-none text-xs mt-[10px] text-secondary"},W={class:"w-full h-full relative"},X={class:"w-full h-full flex items-center justify-center"},Y={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60 operation"},ee={class:"w-full h-full flex items-center justify-center flex-col"},te={class:"leading-none text-xs mt-[10px] text-secondary"},le=L({__name:"index",props:{modelValue:{type:String,default:""},width:{type:String,default:"100px"},height:{type:String,default:"100px"},imageText:{type:String},limit:{type:Number,default:1}},emits:["update:modelValue","change"],setup(a,{emit:w}){const d=a,u=S({get(){return d.modelValue},set(e){w("update:modelValue",e)}}),t=h({data:[]});let b=h([]);const f=()=>{u.value=D(t.data).toString(),b=D(t.data).map(e=>g(e))};P(()=>u.value,()=>{t.data=[...u.value.split(",").filter(e=>e)],f()},{immediate:!0});const p=S(()=>({width:d.width,height:d.height})),k=e=>{d.limit==1?(t.data.splice(0,1),e&&t.data.push(e.url)):e.forEach(r=>{t.data.length<d.limit&&t.data.push(r.url)}),f(),w("change",u.value)},C=(e=0)=>{t.data.splice(e,1),f()},m=h({show:!1,index:0}),V=(e=0)=>{m.show=!0,m.index=e};return(e,r)=>{const z=Z,c=A,I=O,T=q;return o(),n(y,null,[l("div",H,[a.limit==1?(o(),n("div",{key:0,class:"rounded cursor-pointer overflow-hidden relative border border-solid border-color image-wrap mr-[10px]",style:v(i(p))},[t.data.length?(o(),n("div",J,[l("div",K,[s(z,{src:i(g)(t.data[0]),fit:"contain"},null,8,["src"])]),l("div",M,[s(c,{name:"element-ZoomIn",color:"#fff",size:"18px",class:"mr-[10px]",onClick:r[0]||(r[0]=_=>V())}),s(c,{name:"element-Delete",color:"#fff",size:"18px",onClick:C})])])):(o(),j(I,{key:1,limit:a.limit,onConfirm:k},{default:$(()=>[l("div",Q,[s(c,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",U,B(a.imageText||i(N)("upload.root")),1)])]),_:1},8,["limit"]))],4)):(o(),n(y,{key:1},[(o(!0),n(y,null,R(t.data,(_,x)=>(o(),n("div",{class:"rounded cursor-pointer overflow-hidden relative border border-solid border-color image-wrap mr-[10px]",style:v(i(p)),key:x},[l("div",W,[l("div",X,[s(z,{src:i(g)(_),fit:"contain"},null,8,["src"])]),l("div",Y,[s(c,{name:"element-ZoomIn",color:"#fff",size:"18px",class:"mr-[10px]",onClick:F=>V(x)},null,8,["onClick"]),s(c,{name:"element-Delete",color:"#fff",size:"18px",onClick:F=>C(x)},null,8,["onClick"])])])],4))),128)),t.data.length<a.limit?(o(),n("div",{key:0,class:"rounded cursor-pointer overflow-hidden relative border border-dashed border-color",style:v(i(p))},[s(I,{limit:a.limit,onConfirm:k},{default:$(()=>[l("div",ee,[s(c,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",te,B(a.imageText||i(N)("upload.root")),1)])]),_:1},8,["limit"])],4)):E("",!0)],64))]),m.show?(o(),j(T,{key:0,"url-list":i(b),onClose:r[1]||(r[1]=_=>m.show=!1),"initial-index":m.index,"zoom-rate":1},null,8,["url-list","initial-index"])):E("",!0)],64)}}});const re=G(le,[["__scopeId","data-v-45674ef6"]]);export{re as _};
|