2023-03-17 07:27:34 +00:00
|
|
|
import{p as t,q as e,s as o,v as a,o as s,c as i,w as n,l,t as r,x as u,y as c,h as d,k as f,z as h,A as p,r as b,a as g,b as m,e as y,f as _,B as C,F as v,C as S,d as B,D as w,u as x,E as k,g as T,G as U}from"./index.c8b9a6e8.js";import{_ as I}from"./u-icon.14facb7e.js";import{_ as P}from"./plugin-vue_export-helper.21dcd24c.js";const $=(e,o=!1,a)=>new Promise(((s,i)=>{let n=t();a&&(n=t().in(a)),n[o?"selectAll":"select"](e).boundingClientRect((function(t){return o&&Array.isArray(t)&&t.length||!o&&t?s(t):void i("找不到元素")})).exec()}));function z(t,s="navigateTo"){const i=t.query?`${t.path}?${function(t){let e="";for(const o of Object.keys(t)){const s=t[o],i=encodeURIComponent(o)+"=";if(!N(s))if(console.log(encodeURIComponent(o),a(s)),a(s)){for(const t of Object.keys(s))if(!N(s[t])){e+=encodeURIComponent(o+"["+t+"]")+"="+encodeURIComponent(s[t])+"&"}}else e+=i+encodeURIComponent(s)+"&"}return e.slice(0,-1)}(t.query)}`:t.path;"navigateTo"==s&&e({url:i}),"reLaunch"==s&&o({url:i})}const N=t=>null==t&&void 0===t;var R=P({name:"u-badge",props:{type:{type:String,default:"error"},size:{type:String,default:"default"},isDot:{type:Boolean,default:!1},count:{type:[Number,String]},overflowCount:{type:Number,default:99},showZero:{type:Boolean,default:!1},offset:{type:Array,default:()=>[20,20]},absolute:{type:Boolean,default:!0},fontSize:{type:[String,Number],default:"24"},color:{type:String,default:"#ffffff"},bgColor:{type:String,default:""},isCenter:{type:Boolean,default:!1}},computed:{boxStyle(){let t={};return this.isCenter?(t.top=0,t.right=0,t.transform="translateY(-50%) translateX(50%)"):(t.top=this.offset[0]+"rpx",t.right=this.offset[1]+"rpx",t.transform="translateY(0) translateX(0)"),"mini"==this.size&&(t.transform=t.transform+" scale(0.8)"),t},showText(){return this.isDot?"":this.count>this.overflowCount?`${this.overflowCount}+`:this.count},show(){return 0!=this.count||0!=this.showZero}}},[["render",function(t,e,o,a,h,p){const b=f;return p.show?(s(),i(b,{key:0,class:u(["u-badge",[o.isDot?"u-badge-dot":"","mini"==o.size?"u-badge-mini":"",o.type?"u-badge--bg--"+o.type:""]]),style:c([{top:o.offset[0]+"rpx",right:o.offset[1]+"rpx",fontSize:o.fontSize+"rpx",position:o.absolute?"absolute":"static",color:o.color,backgroundColor:o.bgColor},p.boxStyle])},{default:n((()=>[l(r(p.showText),1)])),_:1},8,["class","style"])):d("v-if",!0)}],["__scopeId","data-v-11d03f21"]]);var L=P({emits:["update:modelValue","input","change"],props:{value:{type:[String,Number],default:0},modelValue:{type:[String,Number],default:0},show:{type:Boolean,default:!0},bgColor:{type:String,default:"#ffffff"},height:{type:[String,Number],default:100},iconSize:{type:[String,Number],default:40},midButtonSize:{type:[String,Number],default:90},activeColor:{type:String,default:"#303133"},inactiveColor:{type:String,default:"#606266"},midButton:{type:Boolean,default:!1},list:{type:Array,default:()=>[]},beforeSwitch:{type:Function,default:null},borderTop:{type:Boolean,default:!0},hideTabBar:{type:Boolean,default:!0}},data:()=>({midButtonLeft:"50%",pageUrl:""}),created(){this.hideTabBar&&h();let t=p();this.pageUrl=t[t.length-1].route},computed:{valueCom(){return this.modelValue},elIconPath(){return t=>{let e=this.list[t].pagePath;return e?e==this.pageUrl||e=="/"+this.pageUrl?this.list[t].selectedIconPath:this.list[t].iconPath:t==this.valueCom?this.list[t].selectedIconPath:this.list[t].iconPath}},elColor(){return t=>{let e=this.list[t].pagePath;return e?e==this.pageUrl||e=="/"+this.pageUrl?this.activeColor:this.inactiveColor:t==this.valueCom?this.activeColor:this.inactiveColor}}},mounted(){this.midButton&&this.getMidButtonLeft()},methods:{async clickHandler(t){if(this.beforeSwitch&&"function"==typeof this.beforeSwitch){let e=this.beforeSwitch.bind(this.$u.$parent.call(this))(t);e&&"function"==typeof e.then?await e.then((e=>{this.switchTab(t)})).catch((t=>{})):!0===e&&this.switchTab(t)}else this.switchTab(t)},switchTab(t){let e=this.list[t].pagePath;if(e){if(e==this.pageUrl||e=="/"+this.pageUrl)return;this.$emit("change",t)}else this.$emit("change",t),this.$emit("input"
|