index-Cho1JviK.js 1.8 KB

1
  1. import{ae as B,af as b,bF as v,al as t,ah as m,ai as D,am as y,aj as n,aO as I,av as d,aW as g,ap as h,ak as C,ag as k,aY as L,aX as M}from"./index-D68iA7pN.js";import{M as S}from"./index-AOcxwHT9.js";const U={class:"my-2 d-flex align-center"},j={key:0,style:{"white-space":"pre"}},F={key:1,style:{"white-space":"pre"},class:""},N=B({__name:"MessageBoxDialog",props:{options:{}},setup(o,{expose:i}){const l=b(!1),{isShow:r,showDialog:c,confirm:u,cancel:f}=l,s=Object.assign(v,{question:{icon:"class:iconfont info",color:"rgb(47,144,207)"},none:void 0});let p=[{name:"确定",fun:()=>{},primary:!0},{name:"取消",fun:()=>c(!1)}];const w={escape:()=>{if(o.options.cancelId){const e=p[o.options.cancelId];e.fun.apply(e)}else c(!1),f()},enter:()=>{if(o.options.defaultId){const e=p[o.options.defaultId];e.fun.apply(e)}}};return o.options.buttons&&(p=o.options.buttons.map((e,a)=>({name:e,fun:()=>{u(a),c(!1)},primary:o.options.defaultId===a}))),i({useDialog:l}),(e,a)=>(t(),m(S,{title:e.options.title,modelValue:n(r),"onUpdate:modelValue":a[0]||(a[0]=V=>C(r)?r.value=V:null),footerBtnList:n(p),keys:w,"max-width":"620",width:"auto"},{default:D(()=>[y("div",U,[e.options.type&&n(s)[e.options.type]?(t(),m(I,{key:0,size:36,icon:n(s)[e.options.type]?.icon,class:"mr-2",color:n(s)[e.options.type]?.color},null,8,["icon","color"])):d("",!0),y("div",null,[e.options.message?(t(),g("p",j,h(e.options.message),1)):d("",!0),e.options.detail?(t(),g("p",F,h(e.options.detail),1)):d("",!0)])])]),_:1},8,["title","modelValue","footerBtnList"]))}}),E=B({__name:"index",setup(o){const i=k([]),l=k([]);return(r,c)=>(t(!0),g(M,null,L(i.value,(u,f)=>(t(),m(N,{ref_for:!0,ref_key:"dialogs",ref:l,"onUpdate:modelValue":s=>!s&&i.value.splice(f,1),options:u},null,8,["onUpdate:modelValue","options"]))),256))}});export{E as default};