| 1 |
- import{c as V,t as w,n as I,m as O,u as $,g as j,w as R,e as E,a as F,B as M,i as N,I as z}from"./index-c2909177.js";import{d as B,r as h,c,g as H,a as D,m as K,o as U,b as Y,e as Z,f as m,w as q,v as G,h as d,F as J,u as L,i as Q,p as W,j as X,_ as ee}from"./index-e4df6086.js";import{u as te}from"./use-placeholder-0e4fa972.js";import{B as ae,r as ne,u as oe}from"./use-route-01d6b0b1.js";import{c as ce}from"./interceptor-9a671ee0.js";const[k,S]=V("tabbar"),se={route:Boolean,fixed:w,border:w,zIndex:I,placeholder:Boolean,activeColor:String,beforeChange:Function,inactiveColor:String,modelValue:O(0),safeAreaInsetBottom:{type:Boolean,default:null}},y=Symbol(k);var re=B({name:k,props:se,emits:["change","update:modelValue"],setup(e,{emit:s,slots:o}){const r=h(),{linkChildren:v}=$(y),l=te(r,S),u=()=>{var a;return(a=e.safeAreaInsetBottom)!=null?a:e.fixed},n=()=>{var a;const{fixed:t,zIndex:i,border:p}=e;return c("div",{ref:r,role:"tablist",style:j(i),class:[S({fixed:t}),{[ae]:p,"van-safe-area-bottom":u()}]},[(a=o.default)==null?void 0:a.call(o)])};return v({props:e,setActive:(a,t)=>{ce(e.beforeChange,{args:[a],done(){s("update:modelValue",a),s("change",a),t()}})}}),()=>e.fixed&&e.placeholder?l(n):n()}});const ie=R(re),[le,x]=V("tabbar-item"),ue=E({},ne,{dot:Boolean,icon:String,name:I,badge:I,badgeProps:Object,iconPrefix:String});var de=B({name:le,props:ue,emits:["click"],setup(e,{emit:s,slots:o}){const r=oe(),v=H().proxy,{parent:l,index:u}=F(y);if(!l)return;const n=D(()=>{var t;const{route:i,modelValue:p}=l.props;if(i&&"$route"in v){const{$route:b}=v,{to:g}=e,f=N(g)?g:{path:g};return!!b.matched.find(C=>{const A="path"in f&&f.path===C.path,T="name"in f&&f.name===C.name;return A||T})}return((t=e.name)!=null?t:u.value)===p}),_=t=>{var i;n.value||l.setActive((i=e.name)!=null?i:u.value,r),s("click",t)},a=()=>{if(o.icon)return o.icon({active:n.value});if(e.icon)return c(z,{name:e.icon,classPrefix:e.iconPrefix},null)};return()=>{var t;const{dot:i,badge:p}=e,{activeColor:b,inactiveColor:g}=l.props,f=n.value?b:g;return c("div",{role:"tab",class:x({active:n.value}),style:{color:f},tabindex:0,"aria-selected":n.value,onClick:_},[c(M,K({dot:i,class:x("icon"),content:p},e.badgeProps),{default:a}),c("div",{class:x("text")},[(t=o.default)==null?void 0:t.call(o,{active:n.value})])])}}});const me=R(de);const P=e=>(W("data-v-107bf314"),e=e(),X(),e),ve=P(()=>m("span",null,"工作台",-1)),_e=["src"],fe=P(()=>m("span",null,"设备",-1)),pe=["src"],ge=P(()=>m("span",null,"我的",-1)),he=["src"],be=B({__name:"Index",setup(e){const s=h("/home"),o=L();console.log(o.currentRoute.value.path);const r=h(!0),v=h(document.documentElement.clientHeight);return U(()=>{window.onresize=()=>{v.value>document.documentElement.clientHeight?r.value=!1:r.value=!0},s.value=o.currentRoute.value.path}),(l,u)=>{const n=Q("RouterView"),_=me,a=ie;return Y(),Z(J,null,[m("div",null,[c(n)]),q(c(a,{class:"jj","active-color":"#0047FF",modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=t=>s.value=t)},{default:d(()=>[c(_,{name:"/home",to:"/"},{icon:d(t=>[m("img",{src:t.active?"static/images/icon-home-active.png":"static/images/icon-home.png"},null,8,_e)]),default:d(()=>[ve]),_:1}),c(_,{name:"/device",to:"/device"},{icon:d(t=>[m("img",{src:t.active?"static/images/icon-device-active.png":"static/images/icon-device.png"},null,8,pe)]),default:d(()=>[fe]),_:1}),c(_,{name:"/mine",to:"/mine"},{icon:d(t=>[m("img",{src:t.active?"static/images/icon-mine-active.png":"static/images/icon-mine.png"},null,8,he)]),default:d(()=>[ge]),_:1})]),_:1},8,["modelValue"]),[[G,r.value]])],64)}}});const we=ee(be,[["__scopeId","data-v-107bf314"]]);export{we as default};
|