tyh-ui2
Version:
The next generation ui component library of tyh-ui is based on vue3 Version, fully embrace vue3.
2 lines (1 loc) • 1.71 kB
JavaScript
;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=require("./index2.js"),m={class:"tyh-notification-body"},h={class:"tyh-notification-content"},p={class:"tyh-notification-title"},y={class:"tyh-notification-message"},f=e.defineComponent({name:"TyhNotification"}),v=e.defineComponent({...f,props:d.Props,setup(a){const o=a,n=e.ref(!0);let i;(function(){o.time>0&&(i=setTimeout(()=>{s()},o.time))})();const s=()=>{clearTimeout(i),n.value=!1},l=e.computed(()=>{let t="";switch(o.type){case"primary":t="tyh-ui-smile";break;case"success":t="tyh-ui-success-filling";break;case"danger":t="tyh-ui-error";break;case"warning":t="tyh-ui-warning-filling";break}return t}),r=e.computed(()=>["tyh-icon","tyh-notification-icon",l.value,`tyh-notification-icon-${o.type}`]),c=e.getCurrentInstance(),u=()=>{c.vnode.el.parentElement.removeChild(c.vnode.el)};return(t,_)=>(e.openBlock(),e.createBlock(e.Transition,{name:"tyh-notification-fade",appear:"",onAfterLeave:u},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["tyh-notification",`tyh-notification-${t.position}`])},[e.createElementVNode("div",m,[t.type?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(e.unref(r))},null,2)):e.createCommentVNode("",!0),e.createElementVNode("div",h,[e.createElementVNode("h3",p,e.toDisplayString(t.title),1),e.createElementVNode("div",y,[e.createElementVNode("p",null,e.toDisplayString(t.message),1)])]),t.close?(e.openBlock(),e.createElementBlock("i",{key:1,class:"tyh-icon tyh-ui-close",onClick:s})):e.createCommentVNode("",!0)])],2),[[e.vShow,n.value]])]),_:1}))}});exports.default=v;