1 |
- import{c as v,q as C,m as l,n as I,C as R,D,I as q,z as w,L,w as N}from"./index.0a76c25f.js";import{p,d as O,c as o}from"./index.0c2884d5.js";const[U,a]=v("button"),_=p({},C,{tag:l("button"),text:String,icon:String,type:l("default"),size:l("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:l("button"),loadingSize:I,loadingText:String,loadingType:String,iconPosition:l("left")});var E=O({name:U,props:_,emits:["click"],setup(e,{emit:g,slots:t}){const f=R(),b=()=>t.loading?t.loading():o(L,{size:e.loadingSize,type:e.loadingType,class:a("loading")},null),c=()=>{if(e.loading)return b();if(t.icon)return o("div",{class:a("icon")},[t.icon()]);if(e.icon)return o(q,{name:e.icon,class:a("icon"),classPrefix:e.iconPrefix},null)},m=()=>{let n;if(e.loading?n=e.loadingText:n=t.default?t.default():e.text,n)return o("span",{class:a("text")},[n])},x=()=>{const{color:n,plain:r}=e;if(n){const i={color:r?n:"white"};return r||(i.background=n),n.includes("gradient")?i.border=0:i.borderColor=n,i}},y=n=>{e.loading?w(n):e.disabled||(g("click",n),f())};return()=>{const{tag:n,type:r,size:i,block:S,round:B,plain:P,square:k,loading:T,disabled:s,hairline:d,nativeType:z,iconPosition:u}=e,h=[a([r,i,{plain:P,block:S,round:B,square:k,loading:T,disabled:s,hairline:d}]),{[D]:d}];return o(n,{type:z,class:h,style:x(),disabled:s,onClick:y},{default:()=>[o("div",{class:a("content")},[u==="left"&&c(),m(),u==="right"&&c()])]})}}});const A=N(E);export{A as B};
|