全栈小学生 478de477c8 update admin
2023-07-01 18:29:33 +08:00

2 lines
3.1 KiB
JavaScript

import{_ as S}from"./index.vue_vue_type_style_index_0_lang-671f772c.js";import{C as V}from"./index-341914e3.js";import{t as g}from"./index-047041cb.js";import{g as j,j as w,a4 as B,w as D,m as o,n as a,x as f,u as c,q as l,F as n,D as N,E as b,L as k,I as z,J as T,T as E,b7 as I}from"./base-45eb5090.js";import{_ as $}from"./_plugin-vue_export-helper-c27b6911.js";const F={class:"flex flex-wrap"},L={key:0,class:"w-full h-full relative"},P={class:"w-full h-full flex items-center justify-center"},q={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60 operation"},J={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"},G={class:"w-full h-full flex items-center justify-center"},H={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 r=s,d=w({get(){return r.modelValue},set(t){p("update:modelValue",t)}}),e=B({data:[]}),u=()=>{d.value=I(e.data).toString()};D(()=>d.value,()=>{e.data=[...d.value.split(",").filter(t=>t)],u()},{immediate:!0});const m=w(()=>({width:r.width,height:r.height})),_=t=>{r.limit==1?(e.data.splice(0,1),t&&e.data.push(t.url)):t.forEach(x=>{e.data.length<r.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(c(m))},[e.data.length?(o(),a("div",L,[l("div",P,[n(i,{name:e.data[0],size:"40px"},null,8,["name"])]),l("div",q,[n(i,{name:"element-Delete",color:"#fff",size:"18px",onClick:h})])])):(o(),N(v,{key:1,limit:s.limit,type:"icon",onConfirm:_},{default:b(()=>[l("div",J,[n(i,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",R,k(s.iconText||c(g)("upload.selecticon")),1)])]),_:1},8,["limit"]))],4)):(o(),a(z,{key:1},[(o(!0),a(z,null,T(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(c(m)),key:y},[l("div",A,[l("div",G,[n(i,{name:C,size:"40px"},null,8,["name"])]),l("div",H,[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(c(m))},[n(v,{limit:s.limit,onConfirm:_},{default:b(()=>[l("div",K,[n(i,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",M,k(s.iconText||c(g)("upload.selecticon")),1)])]),_:1},8,["limit"])],4)):E("",!0)],64))])}}});const ee=$(O,[["__scopeId","data-v-17433687"]]);export{ee as _};