2026-07-21 12:36:33 +08:00
|
|
|
import{b as $,bJ as D,bz as S,d as I,bl as V,a as x,o as l,e as n,w as d,K as M,q as h,n as o,f as e,E as k,h as m,r as z,g as i,c,x as g,aa as v,M as A,s as P,bv as j,L as q,Z as F,y as J,j as E,l as K}from"./index-BKKvzUDD.js";import{f as L,b as O}from"./vnode-78qeDweP.js";const Z=["light","dark"],G=$({title:{type:String,default:""},description:{type:String,default:""},type:{type:String,values:D(S),default:"info"},closable:{type:Boolean,default:!0},closeText:{type:String,default:""},showIcon:Boolean,center:Boolean,effect:{type:String,values:Z,default:"light"}}),H={close:t=>t instanceof MouseEvent};var Q=I({name:"ElAlert",__name:"alert",props:G,emits:H,setup(t,{emit:w}){const{Close:B}=j,p=t,T=w,r=V(),s=x("alert"),y=J(!0),b=E(()=>S[p.type]),u=E(()=>{var f;if(p.description)return!0;const a=(f=r.default)==null?void 0:f.call(r);return a?L(a).some(N=>!O(N)):!1}),C=a=>{y.value=!1,T("close",a)};return(a,f)=>(l(),n(F,{name:e(s).b("fade"),persisted:""},{default:d(()=>[M(h("div",{class:o([e(s).b(),e(s).m(t.type),e(s).is("center",t.center),e(s).is(t.effect)]),role:"alert"},[t.showIcon&&(a.$slots.icon||b.value)?(l(),n(e(k),{key:0,class:o([e(s).e("icon"),e(s).is("big",u.value)])},{default:d(()=>[m(a.$slots,"icon",{},()=>[(l(),n(z(b.value)))])]),_:3},8,["class"])):i("v-if",!0),h("div",{class:o(e(s).e("content"))},[t.title||a.$slots.title?(l(),c("span",{key:0,class:o([e(s).e("title"),{"with-description":u.value}])},[m(a.$slots,"title",{},()=>[g(v(t.title),1)])],2)):i("v-if",!0),u.value?(l(),c("p",{key:1,class:o(e(s).e("description"))},[m(a.$slots,"default",{},()=>[g(v(t.description),1)])],2)):i("v-if",!0),t.closable?(l(),c(A,{key:2},[t.closeText?(l(),c("div",{key:0,class:o([e(s).e("close-btn"),e(s).is("customed")]),onClick:C},v(t.closeText),3)):(l(),n(e(k),{key:1,class:o(e(s).e("close-btn")),onClick:C},{default:d(()=>[P(e(B))]),_:1},8,["class"]))],64)):i("v-if",!0)],2)],2),[[q,y.value]])]),_:3},8,["name"]))}}),R=Q;const X=K(R);export{X as E};
|