mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-12 19:02:49 +00:00
2 lines
3.1 KiB
JavaScript
2 lines
3.1 KiB
JavaScript
import{_ as S}from"./index.vue_vue_type_style_index_0_lang-e59c442c.js";import{_ as V}from"./index-981b0207.js";import{t as g}from"./index-81ed253c.js";import{d as j,c as w,R as B,w as N,e as o,f as a,j as f,u as c,g as l,y as n,v as D,x as b,B as k,F as z,z as T,H as $,an as E}from"./base-06478700.js";import{_ as F}from"./_plugin-vue_export-helper-c27b6911.js";const I={class:"flex flex-wrap"},P={key:0,class:"w-full h-full relative"},R={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"},L={class:"w-full h-full flex items-center justify-center flex-col"},q={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"},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 r=s,d=w({get(){return r.modelValue},set(t){p("update:modelValue",t)}}),e=B({data:[]}),u=()=>{d.value=E(e.data).toString()};N(()=>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",I,[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",P,[l("div",R,[n(i,{name:e.data[0],size:"40px"},null,8,["name"])]),l("div",H,[n(i,{name:"element-Delete",color:"#fff",size:"18px",onClick:h})])])):(o(),D(v,{key:1,limit:s.limit,type:"icon",onConfirm:_},{default:b(()=>[l("div",L,[n(i,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",q,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",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(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)):$("",!0)],64))])}}});const ee=F(O,[["__scopeId","data-v-17433687"]]);export{ee as _};
|