mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-02-07 17:55:32 +00:00
2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
import{_ as t}from"./u-icon.71776381.js";import{A as a,B as e,C as o,q as i,t as l,i as n,j as r,w as s,k as c,P as u,R as b,F as d,p as m,G as p,H as v,x as y,I as h,d as f,c as k,O as x,aA as g,n as _,Q as C,y as S,m as D,e as I}from"./index-faf5e276.js";import{_ as P}from"./u-badge.d297a0fc.js";import{_ as $}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as A}from"./u-tabbar.f1e34422.js";const j=$({name:"u-tabbar-item",mixins:[e,o,{props:{name:{type:[String,Number,null],default:a.tabbarItem.name},icon:{icon:String,default:a.tabbarItem.icon},badge:{type:[String,Number,null],default:a.tabbarItem.badge},dot:{type:Boolean,default:a.tabbarItem.dot},text:{type:String,default:a.tabbarItem.text},badgeStyle:{type:[Object,String],default:a.tabbarItem.badgeStyle}}}],data:()=>({isActive:!1,parentData:{value:null,activeColor:"",inactiveColor:""}}),options:{virtualHost:!0},created(){this.init()},methods:{init(){this.updateParentData(),this.parent||uni.$u.error("u-tabbar-item必须搭配u-tabbar组件使用");const t=this.parent.children.indexOf(this);this.isActive=(this.name||t)===this.parentData.value},updateParentData(){this.getParentData("u-tabbar")},updateFromParent(){this.init()},clickHandler(){this.$nextTick((()=>{const t=this.parent.children.indexOf(this),a=this.name||t;a!==this.parent.value&&this.parent.$emit("change",a),this.$emit("click",a)}))}}},[["render",function(a,e,o,f,k,x){const g=i(l("u-icon"),t),_=i(l("u-badge"),P),C=y,S=h;return n(),r(C,{class:"u-tabbar-item",style:m([a.$u.addStyle(a.customStyle)]),onClick:x.clickHandler},{default:s((()=>[c(C,{class:"u-tabbar-item__icon"},{default:s((()=>[a.icon?(n(),r(g,{key:0,name:a.icon,color:k.isActive?k.parentData.activeColor:k.parentData.inactiveColor,size:20},null,8,["name","color"])):(n(),u(b,{key:1},[k.isActive?d(a.$slots,"active-icon",{key:0},void 0,!0):d(a.$slots,"inactive-icon",{key:1},void 0,!0)],64)),c(_,{absolute:"",offset:[0,a.dot?"34rpx":a.badge>9?"14rpx":"20rpx"],customStyle:a.badgeStyle,isDot:a.dot,value:a.badge||(a.dot?1:null),show:a.dot||a.badge>0},null,8,["offset","customStyle","isDot","value","show"])])),_:3}),d(a.$slots,"text",{},(()=>[c(S,{class:"u-tabbar-item__text",style:m({color:k.isActive?k.parentData.activeColor:k.parentData.inactiveColor})},{default:s((()=>[p(v(a.text),1)])),_:1},8,["style"])]),!0)])),_:3},8,["style","onClick"])}],["__scopeId","data-v-b5faebd4"]]),H=$(f({__name:"tabbar",setup(t){const a=k((()=>x().tabbar)),e=k((()=>"/"+g())),o=t=>{I({url:`${t}`,mode:"reLaunch"})};return(t,d)=>{const p=i(l("u-tabbar-item"),j),v=i(l("u-tabbar"),A),h=y;return n(),u(b,null,[_(a)?(n(),r(v,{key:0,value:_(e),onChange:o,zIndex:"9999",fixed:!0,placeholder:!0,safeAreaInsetBottom:!0,"inactive-color":_(a).textColor,"active-color":_(a).textHoverColor},{default:s((()=>[(n(!0),u(b,null,C(_(a).list,(t=>(n(),u(b,null,[1==_(a).type?(n(),r(p,{key:0,style:m({"background-color":_(a).backgroundColor}),text:t.text,icon:_(S)(_(e)==t.link.url?t.iconSelectPath:t.iconPath),name:t.link.url},null,8,["style","text","icon","name"])):D("v-if",!0),2==_(a).type?(n(),r(p,{key:1,style:m({"background-color":_(a).backgroundColor}),icon:_(S)(_(e)==t.link.url?t.iconSelectPath:t.iconPath),name:t.link.url},null,8,["style","icon","name"])):D("v-if",!0),3==_(a).type?(n(),r(p,{key:2,style:m({"background-color":_(a).backgroundColor}),text:t.text,name:t.link.url},null,8,["style","text","name"])):D("v-if",!0)],64)))),256))])),_:1},8,["value","inactive-color","active-color"])):D("v-if",!0),c(h,{class:"tab-bar-placeholder"})],64)}}}),[["__scopeId","data-v-144ba105"]]);export{H as _};
|