Index-fe9585ec.js 3.5 KB

1
  1. import{c as V,t as w,n as I,m as O,u as $,g as j,B as E,w as R,e as F,r as M,a as N,b as z,d as H,i as D,I as K}from"./index-c1f44820.js";import{d as B,r as g,c,g as U,a as Y,m as Z,o as q,b as G,e as J,f as m,w as L,v as Q,h as d,F as W,u as X,i as ee,p as te,j as ae,_ as ne}from"./index-ebd06049.js";import{u as oe}from"./use-placeholder-efd5789a.js";import{c as ce}from"./interceptor-77f719a0.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=g(),{linkChildren:v}=$(y),l=oe(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}),{[E]: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=F({},M,{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=N(),v=U().proxy,{parent:l,index:u}=z(y);if(!l)return;const n=Y(()=>{var t;const{route:i,modelValue:p}=l.props;if(i&&"$route"in v){const{$route:h}=v,{to:b}=e,f=D(b)?b:{path:b};return!!h.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(K,{name:e.icon,classPrefix:e.iconPrefix},null)};return()=>{var t;const{dot:i,badge:p}=e,{activeColor:h,inactiveColor:b}=l.props,f=n.value?h:b;return c("div",{role:"tab",class:x({active:n.value}),style:{color:f},tabindex:0,"aria-selected":n.value,onClick:_},[c(H,Z({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=>(te("data-v-107bf314"),e=e(),ae(),e),ve=P(()=>m("span",null,"工作台",-1)),_e=["src"],fe=P(()=>m("span",null,"设备",-1)),pe=["src"],be=P(()=>m("span",null,"我的",-1)),ge=["src"],he=B({__name:"Index",setup(e){const s=g("/home"),o=X();console.log(o.currentRoute.value.path);const r=g(!0),v=g(document.documentElement.clientHeight);return q(()=>{window.onresize=()=>{v.value>document.documentElement.clientHeight?r.value=!1:r.value=!0},s.value=o.currentRoute.value.path}),(l,u)=>{const n=ee("RouterView"),_=me,a=ie;return G(),J(W,null,[m("div",null,[c(n)]),L(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,ge)]),default:d(()=>[be]),_:1})]),_:1},8,["modelValue"]),[[Q,r.value]])],64)}}});const Ce=ne(he,[["__scopeId","data-v-107bf314"]]);export{Ce as default};