UNPKG

vuux

Version:

Vue3 Nuxt3 Nuxt4 组件库

2 lines (1 loc) 2.58 kB
"use strict";const e=require("vue"),B=require("./hook/useSplitButton.cjs"),l=require("@vuux/icons"),C={key:1,xmlns:"http://www.w3.org/2000/svg",class:"is-loading",width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},g=["ke","onClick"],v=e.defineComponent({name:"SplitButton",__name:"index",props:{items:{default:()=>[]},type:{default:"primary"},icon:{},loading:{type:Boolean},disabled:{type:Boolean},size:{default:"l"},shadow:{type:Boolean,default:!0}},emits:["change"],setup(p,{emit:d}){const o=p,m=d,a=e.useTemplateRef("splitButtonEl"),{classNames:r,isLoading:s,lists:k,isMore:c,handleMore:i,handleClick:h}=B.useSplitButton(o,a,m);return(f,n)=>(e.openBlock(),e.createElementBlock("div",{class:"app-split-button",ref_key:"splitButtonEl",ref:a},[e.createElementVNode("button",{class:e.normalizeClass(["split-button",e.unref(r)])},[e.unref(s)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.icon?(e.openBlock(),e.createBlock(e.unref(l.Icon),{key:0,name:o.icon,size:15,color:"rgba(255, 255, 255)"},null,8,["name"])):e.createCommentVNode("",!0)],64)),e.unref(s)?(e.openBlock(),e.createElementBlock("svg",C,[...n[1]||(n[1]=[e.createStaticVNode('<path d="M12 2v4"></path><path d="m16.2 7.8 2.9-2.9"></path><path d="M18 12h4"></path><path d="m16.2 16.2 2.9 2.9"></path><path d="M12 18v4"></path><path d="m4.9 19.1 2.9-2.9"></path><path d="M2 12h4"></path><path d="m4.9 4.9 2.9 2.9"></path>',8)])])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"default")],2),e.createElementVNode("button",{class:e.normalizeClass(["split-button",e.unref(r)]),onClick:n[0]||(n[0]=(...t)=>e.unref(i)&&e.unref(i)(...t))},[e.createVNode(e.unref(l.Icon),{class:e.normalizeClass(["more-button",{"is-active":e.unref(c)}]),name:"Icon1336922",size:16,color:"#fff"},null,8,["class"])],2),e.createVNode(e.Transition,{name:"ease-drop"},{default:e.withCtx(()=>[e.unref(c)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["split-data",{"is-shadow":o.shadow}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(k),(t,u)=>(e.openBlock(),e.createElementBlock("div",{ke:u,class:"split-item",onClick:y=>e.unref(h)(t.name,u)},[t.icon?(e.openBlock(),e.createBlock(e.unref(l.Icon),{key:0,name:t.icon,size:15,color:"var(--app-icon-color)"},null,8,["name"])):e.createCommentVNode("",!0),e.createElementVNode("p",null,e.toDisplayString(t.name),1)],8,g))),256))],2)):e.createCommentVNode("",!0)]),_:1})],512))}});module.exports=v;