You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
3.1 KiB
1 lines
3.1 KiB
import{_ as S}from"./index.vue_vue_type_style_index_0_lang-cc99af21.js";import{_ as V}from"./index.vue_vue_type_script_setup_true_lang-6f0143c4.js";import{d as j,q as g,n as B,s as N,h as o,c as a,x as f,u as r,a as l,e as n,I as D,w,t as b,N as k,F as z,G as I,B as T,au as $}from"./index-6010b07e.js";import{_ as E}from"./_plugin-vue_export-helper-c27b6911.js";const F={class:"flex flex-wrap"},P={key:0,class:"w-full h-full relative"},q={class:"w-full h-full flex items-center justify-center"},G={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60 operation"},L={class:"w-full h-full flex items-center justify-center flex-col"},R={class:"leading-none text-xs mt-[10px] text-secondary"},A={class:"w-full h-full relative"},H={class:"w-full h-full flex items-center justify-center"},J={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60 operation"},K={class:"w-full h-full flex items-center justify-center flex-col"},M={class:"leading-none text-xs mt-[10px] text-secondary"},O=j({__name:"index",props:{modelValue:{type:String,default:""},width:{type:String,default:"100px"},height:{type:String,default:"100px"},iconText:{type:String},limit:{type:Number,default:1}},emits:["update:modelValue","change"],setup(s,{emit:p}){const c=s,d=g({get(){return c.modelValue},set(t){p("update:modelValue",t)}}),e=B({data:[]}),u=()=>{d.value=$(e.data).toString()};N(()=>d.value,()=>{e.data=[...d.value.split(",").filter(t=>t)],u()},{immediate:!0});const m=g(()=>({width:c.width,height:c.height})),_=t=>{c.limit==1?(e.data.splice(0,1),t&&e.data.push(t.url)):t.forEach(x=>{e.data.length<c.limit&&e.data.push(x.url)}),u(),p("change",d.value)},h=(t=0)=>{e.data.splice(t,1),u()};return(t,x)=>{const i=V,v=S;return o(),a("div",F,[s.limit==1?(o(),a("div",{key:0,class:"rounded cursor-pointer overflow-hidden relative border border-dashed border-color icon-wrap mr-[10px]",style:f(r(m))},[e.data.length?(o(),a("div",P,[l("div",q,[n(i,{name:e.data[0],size:"40px"},null,8,["name"])]),l("div",G,[n(i,{name:"element-Delete",color:"#fff",size:"18px",onClick:h})])])):(o(),D(v,{key:1,limit:s.limit,type:"icon",onConfirm:_},{default:w(()=>[l("div",L,[n(i,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",R,b(s.iconText||r(k)("upload.selecticon")),1)])]),_:1},8,["limit"]))],4)):(o(),a(z,{key:1},[(o(!0),a(z,null,I(e.data,(C,y)=>(o(),a("div",{class:"rounded cursor-pointer overflow-hidden relative border border-dashed border-color icon-wrap mr-[10px]",style:f(r(m)),key:y},[l("div",A,[l("div",H,[n(i,{name:C,size:"40px"},null,8,["name"])]),l("div",J,[n(i,{name:"element-Delete",color:"#fff",size:"18px",onClick:Q=>h(y)},null,8,["onClick"])])])],4))),128)),e.data.length<s.limit?(o(),a("div",{key:0,class:"rounded cursor-pointer overflow-hidden relative border border-dashed border-color",style:f(r(m))},[n(v,{limit:s.limit,onConfirm:_},{default:w(()=>[l("div",K,[n(i,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",M,b(s.iconText||r(k)("upload.selecticon")),1)])]),_:1},8,["limit"])],4)):T("",!0)],64))])}}});const Z=E(O,[["__scopeId","data-v-d7c3fb65"]]);export{Z as _};
|
|
|