test_lgq/niucloud/public/wap/assets/u-tabbar.9997804a.js

2 lines
4.0 KiB
JavaScript
Raw Normal View History

2024-01-24 17:36:08 +08:00
import{U as e,V as t,W as a,h as o,i as l,w as r,J as s,K as u,H as d,n as i,l as n,M as h,p as b,q as p,j as c,I as f,S as g,t as m}from"./index-849cf30e.js";import{_ as y}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as v}from"./u-safe-bottom.2f6af56c.js";const _=y({name:"u-badge",mixins:[t,{props:{isDot:{type:Boolean,default:e.badge.isDot},value:{type:[Number,String],default:e.badge.value},modelValue:{type:[Number,String],default:e.badge.modelValue},show:{type:Boolean,default:e.badge.show},max:{type:[Number,String],default:e.badge.max},type:{type:String,default:e.badge.type},showZero:{type:Boolean,default:e.badge.showZero},bgColor:{type:[String,null],default:e.badge.bgColor},color:{type:[String,null],default:e.badge.color},shape:{type:String,default:e.badge.shape},numberType:{type:String,default:e.badge.numberType},offset:{type:Array,default:e.badge.offset},inverted:{type:Boolean,default:e.badge.inverted},absolute:{type:Boolean,default:e.badge.absolute}}},a],computed:{boxStyle:()=>({}),badgeStyle(){const e={};if(this.color&&(e.color=this.color),this.bgColor&&!this.inverted&&(e.backgroundColor=this.bgColor),this.absolute&&(e.position="absolute",this.offset.length)){const t=this.offset[0],a=this.offset[1]||t;e.top=uni.$u.addUnit(t),e.right=uni.$u.addUnit(a)}return e},showValue(){switch(this.numberType){case"overflow":return Number(this.value)>Number(this.max)?this.max+"+":this.value;case"ellipsis":return Number(this.value)>Number(this.max)?"...":this.value;case"limit":return Number(this.value)>999?Number(this.value)>=9999?Math.floor(this.value/1e4*100)/100+"w":Math.floor(this.value/1e3*100)/100+"k":this.value;default:return Number(this.value)}}}},[["render",function(e,t,a,b,p,c){const f=h;return e.show&&(0!==Number(e.value)||e.showZero||e.isDot)?(o(),l(f,{key:0,class:d([[e.isDot?"u-badge--dot":"u-badge--not-dot",e.inverted&&"u-badge--inverted","horn"===e.shape&&"u-badge--horn",`u-badge--${e.type}${e.inverted?"--inverted":""}`],"u-badge"]),style:i([e.$u.addStyle(e.customStyle),c.badgeStyle])},{default:r((()=>[s(u(e.isDot?"":c.showValue),1)])),_:1},8,["class","style"])):n("v-if",!0)}],["__scopeId","data-v-99cd5b85"]]);const x=y({name:"u-tabbar",mixins:[t,a,{props:{value:{type:[String,Number,null],default:e.tabbar.value},safeAreaInsetBottom:{type:Boolean,default:e.tabbar.safeAreaInsetBottom},border:{type:Boolean,default:e.tabbar.border},zIndex:{type:[String,Number],default:e.tabbar.zIndex},activeColor:{type:String,default:e.tabbar.activeColor},inactiveColor:{type:String,default:e.tabbar.inactiveColor},fixed:{type:Boolean,default:e.tabbar.fixed},placeholder:{type:Boolean,default:e.tabbar.placeholder}}}],data:()=>({placeholderHeight:0}),computed:{tabbarStyle(){const e={zIndex:this.zIndex};return uni.$u.deepMerge(e,uni.$u.addStyle(this.customStyle))},updateChild(){return[this.value,this.activeColor,this.inactiveColor]},updatePlaceholder(){return[this.fixed,this.placeholder]}},watch:{updateChild(){this.updateChildren()},updatePlaceholder(){this.setPlaceholderHeight()}},created(){this.children=[]},mounted(){this.setPlaceholderHeight()},methods:{updateChildren(){this.children.length&&this.children.map((e=>e.updateFromParent()))},async setPlaceholderHeight(){this.fixed&&this.placeholder&&(await uni.$u.sleep(20),this.$uGetRect(".u-tabbar__content").then((({height:e=50})=>{this.placeholderHeight=e})))}}},[["render",function(e,t,a,s,u,h){const y=m,_=b(p("u-safe-bottom"),v);return o(),l(y,{class:"u-tabbar"},{default:r((()=>[c(y,{class:d(["u-tabbar__content",[e.border&&"u-border-top",e.fixed&&"u-tabbar--fixed"]]),ref:"u-tabbar__content",onTouchmove:f(e.noop,["stop","prevent"]),style:i([h.tabbarStyle])},{default:r((()=>[c(y,{class:"u-tabbar__content__item-wrapper"},{default:r((()=>[g(e.$slots,"default",{},void 0,!0)])),_:3}),e.safeAreaInsetBottom?(o(),l(_,{key:0})):n("v-if",!0)])),_:3},8,["onTouchmove","class","style"]),e.placeholder?(o(),l(y,{key:0,class:"u-tabbar__placeholder",style:i({height:u.placeholderHeight+"px"})},null,8,["style"])):n("v-if",!0)])),_:3})}],["__scopeId","data-v-b564ac71"]]);export{_,x as a};