import{B as C,f as E,C as B,h as N}from"./element-plus-z3MwpXC9.js";import{_ as $}from"./index-BhjDDGVa.js";import{_ as z}from"./picker-Cx07Sp9S.js";import{f as r,b as D}from"./index-DXEGVToZ.js";import{D as A}from"./vuedraggable-OYPBN08G.js";import{d as I,b as L,ah as R,o as p,c as S,a as l,V as a,M as d,L as F,u as c,i as M,S as P}from"./@vue-TMcuEboY.js";const T={class:"bg-fill-light flex items-center w-full p-4 mb-4"},j={class:"upload-btn w-[60px] h-[60px]"},q={class:"ml-3 flex-1"},G={class:"flex items-center"},H={class:"flex items-center mt-[18px]"},J={class:"flex-1 flex items-center"},K={class:"drag-move cursor-move ml-auto"},ee=I({__name:"add-nav",props:{modelValue:{type:Array,default:()=>[]},max:{type:Number,default:100},min:{type:Number,default:1}},emits:["update:modelValue"],setup(_,{emit:f}){const t=_,V=f,m=L({get(){return t.modelValue},set(s){V("update:modelValue",s)}}),x=()=>{var s;((s=t.modelValue)==null?void 0:s.length)<t.max?m.value.push({image:"",name:"导航名称",link:{},is_show:"1"}):r.msgError(`最多添加${t.max}个`)},v=s=>{var e;if(((e=t.modelValue)==null?void 0:e.length)<=t.min)return r.msgError(`最少保留${t.min}个`);m.value.splice(s,1)};return(s,e)=>{const i=D,g=z,h=C,k=R("link-picker"),b=E,w=B,y=$,U=N;return p(),S("div",null,[l("div",null,[a(c(A),{class:"draggable",modelValue:c(m),"onUpdate:modelValue":e[0]||(e[0]=o=>M(m)?m.value=o:null),animation:"300",handle:".drag-move","item-key":"index"},{item:d(({element:o,index:u})=>[(p(),F(y,{class:"w-[467px]",key:u,onClose:n=>v(u)},{default:d(()=>[l("div",T,[a(g,{modelValue:o.image,"onUpdate:modelValue":n=>o.image=n,"upload-class":"bg-body",size:"60px","exclude-domain":""},{upload:d(()=>[l("div",j,[a(i,{name:"el-icon-Plus",size:20})])]),_:2},1032,["modelValue","onUpdate:modelValue"]),l("div",q,[l("div",G,[e[1]||(e[1]=l("span",{class:"text-tx-regular flex-none mr-3"},"名称",-1)),a(h,{modelValue:o.name,"onUpdate:modelValue":n=>o.name=n,placeholder:"请输入名称"},null,8,["modelValue","onUpdate:modelValue"])]),l("div",H,[e[2]||(e[2]=l("span",{class:"text-tx-regular flex-none mr-3"},"链接",-1)),a(k,{modelValue:o.link,"onUpdate:modelValue":n=>o.link=n},null,8,["modelValue","onUpdate:modelValue"])]),a(w,{label:"是否显示",class:"mt-[18px]"},{default:d(()=>[l("div",J,[a(b,{modelValue:o.is_show,"onUpdate:modelValue":n=>o.is_show=n,"active-value":"1","inactive-value":"0"},null,8,["modelValue","onUpdate:modelValue"]),l("div",K,[a(i,{name:"el-icon-Rank",size:"18"})])])]),_:2},1024)])])]),_:2},1032,["onClose"]))]),_:1},8,["modelValue"])]),l("div",null,[a(U,{type:"primary",onClick:x},{default:d(()=>e[3]||(e[3]=[P("添加")])),_:1})])])}}});export{ee as _};
