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.96 kB
JavaScript
;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),p=require("./index2.js"),u=["onClick"],h={key:0,class:"tyh-drawer-header"},m={key:0,class:"tyh-drawer-title"},y={key:1,class:"tyh-drawer-title"},k=["onClick"],f={key:1,class:"tyh-drawer-body"},w=e.defineComponent({name:"TyhDrawer"}),C=e.defineComponent({...w,props:p.Props,emits:["update:modelValue","open","close","onOpen","onClose"],setup(r,{emit:n}){const l=r,s=()=>{n("close"),n("update:modelValue",!1)},a=e.computed(()=>{const o=l.direction;return o==="left"||o==="right"||o===""}),i=()=>{!l.modalClose||s()},{proxy:d}=e.getCurrentInstance();return e.watch(()=>l.modelValue,o=>{o&&n("open");const t=d.$el;o&&l.appendToBody&&document.body.appendChild(t)}),(o,t)=>(e.openBlock(),e.createBlock(e.Transition,{name:"tyh-drawer",onAfterEnter:t[0]||(t[0]=c=>n("onOpen")),onAfterLeave:t[1]||(t[1]=c=>n("onClose"))},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["tyh-drawer-packing",{"tyh-drawer-modal":o.modal}]),style:e.normalizeStyle({zIndex:o.zIndex}),onClick:e.withModifiers(i,["self"])},[e.createElementVNode("div",{class:e.normalizeClass(["tyh-drawer",`tyh-drawer-${o.direction}`]),style:e.normalizeStyle(e.unref(a)?`width: ${o.size}`:`height: ${o.size}`)},[o.showHeader?(e.openBlock(),e.createElementBlock("div",h,[o.$slots.title?(e.openBlock(),e.createElementBlock("span",m,[e.renderSlot(o.$slots,"title")])):(e.openBlock(),e.createElementBlock("span",y,e.toDisplayString(o.title),1)),o.showClose?(e.openBlock(),e.createElementBlock("i",{key:2,class:"tyh-icon tyh-ui-close",onClick:e.withModifiers(s,["stop"])},null,8,k)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),o.$slots.default?(e.openBlock(),e.createElementBlock("div",f,[e.renderSlot(o.$slots,"default")])):e.createCommentVNode("",!0)],6)],14,u),[[e.vShow,o.modelValue]])]),_:3}))}});exports.default=C;