Index-aea59141.js 3.6 KB

1
  1. import{d as C,r as h,c as i,g as j,a as E,m as F,w as M,o as N,b as z,e as b,f as v,h as D,v as H,F as K,u as U,i as Y,j as g,k as B,l as w,K as Z,_ as q}from"./index-ddf66cb5.js";import{c as R,t as y,n as P,m as G,u as J,g as L,B as Q,w as V,e as W,a as X,b as ee,i as te,I as ae}from"./index-e9453d64.js";import{u as ne}from"./use-placeholder-1196d982.js";import{c as oe}from"./on-popup-reopen-8ab517b6.js";import{r as re,u as ce}from"./use-route-0a2b7081.js";const[S,A]=R("tabbar"),se={route:Boolean,fixed:y,border:y,zIndex:P,placeholder:Boolean,activeColor:String,beforeChange:Function,inactiveColor:String,modelValue:G(0),safeAreaInsetBottom:{type:Boolean,default:null}},T=Symbol(S);var le=C({name:S,props:se,emits:["change","update:modelValue"],setup(t,{emit:s,slots:o}){const u=h(),{linkChildren:d}=J(T),l=ne(u,A),a=()=>{var n;return(n=t.safeAreaInsetBottom)!=null?n:t.fixed},r=()=>{var n;const{fixed:e,zIndex:c,border:_}=t;return i("div",{ref:u,role:"tablist",style:L(c),class:[A({fixed:e}),{[Q]:_,"van-safe-area-bottom":a()}]},[(n=o.default)==null?void 0:n.call(o)])};return d({props:t,setActive:(n,e)=>{oe(t.beforeChange,{args:[n],done(){s("update:modelValue",n),s("change",n),e()}})}}),()=>t.fixed&&t.placeholder?l(r):r()}});const ie=V(le),[ue,I]=R("tabbar-item"),de=W({},re,{dot:Boolean,icon:String,name:P,badge:P,badgeProps:Object,iconPrefix:String});var me=C({name:ue,props:de,emits:["click"],setup(t,{emit:s,slots:o}){const u=ce(),d=j().proxy,{parent:l,index:a}=X(T);if(!l)return;const r=E(()=>{var e;const{route:c,modelValue:_}=l.props;if(c&&"$route"in d){const{$route:x}=d,{to:p}=t,m=te(p)?p:{path:p};return!!x.matched.find(k=>{const O="path"in m&&m.path===k.path,$="name"in m&&m.name===k.name;return O||$})}return((e=t.name)!=null?e:a.value)===_}),f=e=>{var c;r.value||l.setActive((c=t.name)!=null?c:a.value,u),s("click",e)},n=()=>{if(o.icon)return o.icon({active:r.value});if(t.icon)return i(ae,{name:t.icon,classPrefix:t.iconPrefix},null)};return()=>{var e;const{dot:c,badge:_}=t,{activeColor:x,inactiveColor:p}=l.props,m=r.value?x:p;return i("div",{role:"tab",class:I({active:r.value}),style:{color:m},tabindex:0,"aria-selected":r.value,onClick:f},[i(ee,F({dot:c,class:I("icon"),content:_},t.badgeProps),{default:n}),i("div",{class:I("text")},[(e=o.default)==null?void 0:e.call(o,{active:r.value})])])}}});const ve=V(me);const fe=["src"],_e=["src"],pe=C({__name:"Index",setup(t){const s=h("/home"),o=U();M(()=>o.currentRoute.value.path,(l,a)=>{console.log("路由参数发生了变化",l,a),s.value=o.currentRoute.value.path}),console.log(o.currentRoute.value.path);const u=h(!0),d=h(document.documentElement.clientHeight);return N(()=>{window.onresize=()=>{d.value>document.documentElement.clientHeight?u.value=!1:u.value=!0},s.value=o.currentRoute.value.path}),(l,a)=>{const r=Y("router-view"),f=ve,n=ie;return g(),z(K,null,[b("div",null,[i(r,null,{default:v(({Component:e,route:c})=>[c.meta.keepAlive?(g(),B(Z,{key:0},[(g(),B(w(e)))],1024)):(g(),B(w(e),{key:1}))]),_:1})]),D(i(n,{style:{"border-top":"1px solid #f0f0f0"},class:"jj","active-color":"#0047FF",modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=e=>s.value=e)},{default:v(()=>[i(f,{name:"/device",to:"/device"},{icon:v(e=>[b("img",{src:e.active?"static/images/icon-device-active.png":"static/images/icon-device.png"},null,8,fe)]),default:v(()=>[a[1]||(a[1]=b("span",null,"设备",-1))]),_:1}),i(f,{name:"/mine",to:"/mine"},{icon:v(e=>[b("img",{src:e.active?"static/images/icon-mine-active.png":"static/images/icon-mine.png"},null,8,_e)]),default:v(()=>[a[2]||(a[2]=b("span",null,"我的",-1))]),_:1})]),_:1},8,["modelValue"]),[[H,u.value]])],64)}}});const Ie=q(pe,[["__scopeId","data-v-6d831333"]]);export{Ie as default};