2 lines
4.5 KiB
JavaScript
2 lines
4.5 KiB
JavaScript
var e,t;import{a as o}from"./uv-transition.b33e1d5c.js";import{G as a,H as s,Y as i,g as r,o as l,c as n,w as d,a as p,n as u,A as m,b as g,F as h,h as c,t as y,m as f,j as S,K as b,af as v,d as x}from"./index-d76b1e7a.js";import{r as T}from"./useRouter.2bdb47a0.js";import{_ as z}from"./uv-icon.5730d4d2.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";const _=C({name:"uv-button",mixins:[a,s,{props:{hairline:{type:Boolean,default:!0},type:{type:String,default:"info"},size:{type:String,default:"normal"},shape:{type:String,default:"square"},plain:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{type:[String,Number],default:""},loadingMode:{type:String,default:"spinner"},loadingSize:{type:[String,Number],default:14},openType:{type:String,default:""},formType:{type:String,default:""},appParameter:{type:String,default:""},hoverStopPropagation:{type:Boolean,default:!0},lang:{type:String,default:"en"},sessionFrom:{type:String,default:""},sendMessageTitle:{type:String,default:""},sendMessagePath:{type:String,default:""},sendMessageImg:{type:String,default:""},showMessageCard:{type:Boolean,default:!0},dataName:{type:String,default:""},throttleTime:{type:[String,Number],default:0},hoverStartTime:{type:[String,Number],default:0},hoverStayTime:{type:[String,Number],default:200},text:{type:[String,Number],default:""},icon:{type:String,default:""},iconColor:{type:String,default:"#000000"},color:{type:String,default:""},customTextStyle:{type:[Object,String],default:()=>{}},...null==(t=null==(e=uni.$uv)?void 0:e.props)?void 0:t.button}}],emits:["click"],data:()=>({}),computed:{bemClass(){return this.color?this.bem("button",["shape","size"],["disabled","plain","hairline"]):this.bem("button",["type","shape","size"],["disabled","plain","hairline"])},loadingColor(){return this.plain?this.color?this.color:"#3c9cff":"info"===this.type?"#c9c9c9":"rgb(200, 200, 200)"},iconColorCom(){return this.iconColor?this.iconColor:this.plain?this.color?this.color:this.type:"info"===this.type?"#000000":"#ffffff"},baseColor(){let e={};return this.color&&(e.color=this.plain?this.color:"white",this.plain||(e["background-color"]=this.color),-1!==this.color.indexOf("gradient")?(e.borderTopWidth=0,e.borderRightWidth=0,e.borderBottomWidth=0,e.borderLeftWidth=0,this.plain||(e.backgroundImage=this.color)):(e.borderColor=this.color,e.borderWidth="1px",e.borderStyle="solid")),e},nvueTextStyle(){let e={};return"info"===this.type&&(e.color="#323233"),this.color&&(e.color=this.plain?this.color:"white"),e.fontSize=this.textSize+"px",e},textSize(){let e=14,{size:t}=this;return"large"===t&&(e=16),"normal"===t&&(e=14),"small"===t&&(e=12),"mini"===t&&(e=10),e}},methods:{clickHandler(){this.disabled||this.loading||i((()=>{this.$emit("click")}),this.throttleTime)}}},[["render",function(e,t,a,s,i,C){const _=T(r("uv-loading-icon"),o),k=b,M=T(r("uv-icon"),z),N=v,w=x;return l(),n(w,{class:"uv-button-wrapper"},{default:d((()=>[p(N,{"hover-start-time":Number(e.hoverStartTime),"hover-stay-time":Number(e.hoverStayTime),"form-type":e.formType,"open-type":e.openType,"app-parameter":e.appParameter,"hover-stop-propagation":e.hoverStopPropagation,"send-message-title":e.sendMessageTitle,"send-message-path":e.sendMessagePath,lang:e.lang,"data-name":e.dataName,"session-from":e.sessionFrom,"send-message-img":e.sendMessageImg,"show-message-card":e.showMessageCard,"hover-class":e.disabled||e.loading?"":"uv-button--active",class:u(["uv-button uv-reset-button",C.bemClass]),style:m([C.baseColor,e.$uv.addStyle(e.customStyle)]),onClick:C.clickHandler},{default:d((()=>[e.loading?(l(),g(h,{key:0},[p(_,{mode:e.loadingMode,size:1.15*e.loadingSize,color:C.loadingColor},null,8,["mode","size","color"]),p(k,{class:"uv-button__loading-text",style:m([{fontSize:C.textSize+"px"},e.$uv.addStyle(e.customTextStyle)])},{default:d((()=>[c(y(e.loadingText||e.text),1)])),_:1},8,["style"])],64)):(l(),g(h,{key:1},[e.icon?(l(),n(M,{key:0,name:e.icon,color:C.iconColorCom,size:1.35*C.textSize,customStyle:{marginRight:"2px"}},null,8,["name","color","size"])):f("",!0),S(e.$slots,"default",{},(()=>[p(k,{class:"uv-button__text",style:m([{fontSize:C.textSize+"px"},e.$uv.addStyle(e.customTextStyle)])},{default:d((()=>[c(y(e.text),1)])),_:1},8,["style"])]),!0)],64))])),_:3},8,["hover-start-time","hover-stay-time","form-type","open-type","app-parameter","hover-stop-propagation","send-message-title","send-message-path","lang","data-name","session-from","send-message-img","show-message-card","hover-class","style","onClick","class"])])),_:3})}],["__scopeId","data-v-3da89cc2"]]);export{_};
|