mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-14 19:52:48 +00:00
2 lines
3.9 KiB
JavaScript
2 lines
3.9 KiB
JavaScript
import"./base-0e92f4db.js";/* empty css */import{_ as L}from"./index.vue_vue_type_style_index_0_lang-89cfc1da.js";import{_ as O}from"./index-9033603c.js";/* empty css */import{c as h}from"./common-46715e7e.js";import{t as S}from"./index-8f29cb04.js";import{E as P}from"./index-c7745eb3.js";import{E as Z}from"./index-2b1dc445.js";import{d as q,c as j,M as v,w as M,b as o,e as n,f as l,h as g,u as a,q as i,m as E,p as $,x as B,F as y,t as R,C as N,af as D}from"./runtime-core.esm-bundler-67034826.js";import{_ as A}from"./_plugin-vue_export-helper-c27b6911.js";const G={class:"flex flex-wrap"},H={key:0,class:"w-full h-full relative"},J={class:"w-full h-full flex items-center justify-center"},K={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=q({__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(s,{emit:w}){const m=s,r=j({get(){return m.modelValue},set(t){w("update:modelValue",t)}}),e=v({data:[]});let b=v([]);const u=()=>{r.value=D(e.data).toString(),b=D(e.data).map(t=>h(t))};M(()=>r.value,()=>{r.value.indexOf("data:image")!=-1?e.data[0]=r.value+"":e.data=[...r.value.split(",").filter(t=>t)],u()},{immediate:!0});const p=j(()=>({width:m.width,height:m.height})),k=t=>{m.limit==1?(e.data.splice(0,1),t&&e.data.push(t.url)):t.forEach(c=>{e.data.length<m.limit&&e.data.push(c.url)}),u(),w("change",r.value)},C=(t=0)=>{e.data.splice(t,1),u()},f=v({show:!1,index:0}),z=(t=0)=>{f.show=!0,f.index=t};return(t,c)=>{const V=Z,d=O,I=L,T=P;return o(),n(y,null,[l("div",G,[s.limit==1?(o(),n("div",{key:0,class:"cursor-pointer overflow-hidden relative border border-solid border-color image-wrap mr-[10px]",style:g(a(p))},[e.data.length?(o(),n("div",H,[l("div",J,[i(V,{src:e.data[0].indexOf("data:image")!=-1?e.data[0]:a(h)(e.data[0]),fit:"contain"},null,8,["src"])]),l("div",K,[i(d,{name:"element-ZoomIn",color:"#fff",size:"18px",class:"mr-[10px]",onClick:c[0]||(c[0]=_=>z())}),i(d,{name:"element-Delete",color:"#fff",size:"18px",onClick:C})])])):(o(),E(I,{key:1,limit:s.limit,onConfirm:k},{default:$(()=>[l("div",Q,[i(d,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",U,B(s.imageText||a(S)("upload.root")),1)])]),_:1},8,["limit"]))],4)):(o(),n(y,{key:1},[(o(!0),n(y,null,R(e.data,(_,x)=>(o(),n("div",{class:"cursor-pointer overflow-hidden relative border border-solid border-color image-wrap mr-[10px]",style:g(a(p)),key:x},[l("div",W,[l("div",X,[i(V,{src:a(h)(_),fit:"contain"},null,8,["src"])]),l("div",Y,[i(d,{name:"element-ZoomIn",color:"#fff",size:"18px",class:"mr-[10px]",onClick:F=>z(x)},null,8,["onClick"]),i(d,{name:"element-Delete",color:"#fff",size:"18px",onClick:F=>C(x)},null,8,["onClick"])])])],4))),128)),e.data.length<s.limit?(o(),n("div",{key:0,class:"rounded cursor-pointer overflow-hidden relative border border-dashed border-color",style:g(a(p))},[i(I,{limit:s.limit,onConfirm:k},{default:$(()=>[l("div",ee,[i(d,{name:"element-Plus",size:"20px",color:"var(--el-text-color-secondary)"}),l("div",te,B(s.imageText||a(S)("upload.root")),1)])]),_:1},8,["limit"])],4)):N("",!0)],64))]),f.show?(o(),E(T,{key:0,"url-list":a(b),onClose:c[1]||(c[1]=_=>f.show=!1),"initial-index":f.index,"zoom-rate":1},null,8,["url-list","initial-index"])):N("",!0)],64)}}});const pe=A(le,[["__scopeId","data-v-8dae4fdf"]]);export{pe as _};
|