test_lgq/niucloud/public/admin/assets/index-2d277c91.js
2024-01-24 17:36:08 +08:00

2 lines
3.1 KiB
JavaScript

import{_ as S}from"./index.vue_vue_type_style_index_0_lang-5c6c00d9.js";import{_ as V}from"./index.vue_vue_type_script_setup_true_lang-9285296e.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 as b,t as w,N as k,F as z,G as I,B as T,ax as $,_ as E}from"./index-4dcc0234.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:_}){const c=s,d=g({get(){return c.modelValue},set(t){_("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})),h=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(),_("change",d.value)},p=(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:p})])])):(o(),D(v,{key:1,limit:s.limit,type:"icon",onConfirm:h},{default:b(()=>[l("div",L,[n(i,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",R,w(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=>p(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:h},{default:b(()=>[l("div",K,[n(i,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",M,w(s.iconText||r(k)("upload.selecticon")),1)])]),_:1},8,["limit"])],4)):T("",!0)],64))])}}});const Y=E(O,[["__scopeId","data-v-8eeeb4b2"]]);export{Y as _};