1 |
- !function(){function e(e,a){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==a)return;var t,r,o=[],i=!0,l=!1;try{for(a=a.call(e);!(i=(t=a.next()).done)&&(o.push(t.value),!n||o.length!==n);i=!0);}catch(c){l=!0,r=c}finally{try{i||null==a.return||a.return()}finally{if(l)throw r}}return o}(e,a)||function(e,a){if(!e)return;if("string"==typeof e)return n(e,a);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return n(e,a)}(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,n){(null==n||n>e.length)&&(n=e.length);for(var a=0,t=new Array(n);a<n;a++)t[a]=e[a];return t}var a=document.createElement("style");a.innerHTML=":root{--van-tab-text-color: var(--van-gray-7);--van-tab-active-text-color: var(--van-text-color);--van-tab-disabled-text-color: var(--van-text-color-3);--van-tab-font-size: var(--van-font-size-md);--van-tab-line-height: var(--van-line-height-md);--van-tabs-default-color: var(--van-danger-color);--van-tabs-line-height: 1.17333rem;--van-tabs-card-height: .8rem;--van-tabs-nav-background-color: var(--van-background-color-light);--van-tabs-bottom-bar-width: 1.06667rem;--van-tabs-bottom-bar-height: .08rem;--van-tabs-bottom-bar-color: var(--van-danger-color)}.van-tab{position:relative;display:flex;flex:1;align-items:center;justify-content:center;box-sizing:border-box;padding:0 var(--van-padding-base);color:var(--van-tab-text-color);font-size:var(--van-tab-font-size);line-height:var(--van-tab-line-height);cursor:pointer}.van-tab--active{color:var(--van-tab-active-text-color);font-weight:var(--van-font-weight-bold)}.van-tab--disabled{color:var(--van-tab-disabled-text-color);cursor:not-allowed}.van-tab--grow{flex:1 0 auto;padding:0 var(--van-padding-sm)}.van-tab--shrink{flex:none;padding:0 var(--van-padding-xs)}.van-tab--card{color:var(--van-tabs-default-color);border-right:var(--van-border-width-base) solid var(--van-tabs-default-color)}.van-tab--card:last-child{border-right:none}.van-tab--card.van-tab--active{color:var(--van-white);background-color:var(--van-tabs-default-color)}.van-tab--card--disabled{color:var(--van-tab-disabled-text-color)}.van-tab__text--ellipsis{display:-webkit-box;overflow:hidden;-webkit-line-clamp:1;-webkit-box-orient:vertical}.van-tabs{position:relative}.van-tabs__wrap{overflow:hidden}.van-tabs__wrap--page-top{position:fixed}.van-tabs__wrap--content-bottom{top:auto;bottom:0}.van-tabs__nav{position:relative;display:flex;background:var(--van-tabs-nav-background-color);-webkit-user-select:none;-moz-user-select:none;user-select:none}.van-tabs__nav--complete{overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}.van-tabs__nav--complete::-webkit-scrollbar{display:none}.van-tabs__nav--line{box-sizing:content-box;height:100%;padding-bottom:.4rem}.van-tabs__nav--line.van-tabs__nav--shrink,.van-tabs__nav--line.van-tabs__nav--complete{padding-right:var(--van-padding-xs);padding-left:var(--van-padding-xs)}.van-tabs__nav--card{box-sizing:border-box;height:var(--van-tabs-card-height);margin:0 var(--van-padding-md);border:var(--van-border-width-base) solid var(--van-tabs-default-color);border-radius:var(--van-border-radius-sm)}.van-tabs__nav--card.van-tabs__nav--shrink{display:inline-flex}.van-tabs__line{position:absolute;bottom:.4rem;left:0;z-index:1;width:var(--van-tabs-bottom-bar-width);height:var(--van-tabs-bottom-bar-height);background:var(--van-tabs-bottom-bar-color);border-radius:var(--van-tabs-bottom-bar-height)}.van-tabs__track{position:relative;display:flex;width:100%;height:100%;will-change:left}.van-tabs__content--animated{overflow:hidden}.van-tabs--line .van-tabs__wrap{height:var(--van-tabs-line-height)}.van-tabs--card>.van-tabs__wrap{height:var(--van-tabs-card-height)}.van-tab__panel,.van-tab__panel-wrapper{flex-shrink:0;box-sizing:border-box;width:100%}.van-tab__panel-wrapper--inactive{height:0;overflow:visible}\n",document.head.appendChild(a),System.register(["./index-legacy.fba2875c.js","./use-id-legacy.db87b112.js","./use-tab-status-legacy.8752ccde.js","./index-legacy.af00a324.js","./use-refs-legacy.2affcb61.js","./index-legacy.edb65d0c.js"],(function(n){"use strict";var a,t,r,o,i,l,c,d,s,u,v,b,f,h,p,g,m,y,x,w,k,_,S,I,C,B,z,A,T,j,R,L,$,V,W,M,N,O,Z,E,H,D,X,F,U,G,J,P,Q,q,K,Y,ee;return{setters:[function(e){a=e.at,t=e.ag,r=e.au,o=e.A,i=e.d,l=e.E,c=e.G,d=e.V,s=e.j,u=e.L,v=e.av,b=e.aw,f=e.S,h=e.a2,p=e.U,g=e.$,m=e.aa,y=e.a0,x=e.ab,w=e.ai,k=e.Q,_=e.ac,S=e.ak,I=e.W,C=e.aj,B=e.an,z=e.ao,A=e.a9,T=e.ae,j=e.af,R=e.a1,L=e.ax,$=e.ay,V=e.az,W=e.a7,M=e.aA,N=e.X,O=e.aB,Z=e.aC,E=e.I,H=e.J,D=e.H,X=e.as,F=e.aD,U=e.a5,G=e.aE,J=e.N},function(e){P=e.u},function(e){Q=e.T},function(e){q=e.S,K=e.a},function(e){Y=e.u},function(e){ee=e.S}],execute:function(){function ne(e,n,o,i){var l=t(e),c=l<n,d=0===o?1:Math.round(1e3*o/16),s=(n-l)/d;!function t(){l+=s,(c&&l>n||!c&&l<n)&&(l=n),r(e,l),c&&l<n||!c&&l>n?a(t):i&&a(i)}()}var ae=e(o("tab"),2),te=ae[0],re=ae[1],oe=i({name:te,props:{id:String,dot:Boolean,type:String,color:String,title:String,badge:l,shrink:Boolean,isActive:Boolean,disabled:Boolean,controls:String,scrollable:Boolean,activeColor:String,inactiveColor:String,showZeroBadge:c},setup:function(e,n){var a=n.slots,t=d((function(){var n={},a=e.type,t=e.color,r=e.disabled,o=e.isActive,i=e.activeColor,l=e.inactiveColor;t&&"card"===a&&(n.borderColor=t,r||(o?n.backgroundColor=t:n.color=t));var c=o?i:l;return c&&(n.color=c),n}));return function(){return s("div",{id:e.id,role:"tab",class:[re([e.type,{grow:e.scrollable&&!e.shrink,shrink:e.shrink,active:e.isActive,disabled:e.disabled}])],style:t.value,tabindex:e.disabled?void 0:e.isActive?0:-1,"aria-selected":e.isActive,"aria-disabled":e.disabled||void 0,"aria-controls":e.controls},[(n=s("span",{class:re("text",{ellipsis:!e.scrollable})},[a.title?a.title():e.title]),e.dot||u(e.badge)&&""!==e.badge?s(v,{dot:e.dot,content:e.badge,showZero:e.showZeroBadge},{default:function(){return[n]}}):n)]);var n}}}),ie=e(o("tabs"),2),le=ie[0],ce=ie[1],de=i({name:le,props:{count:b(Number),inited:Boolean,animated:Boolean,duration:b(l),swipeable:Boolean,lazyRender:Boolean,currentIndex:b(Number)},emits:["change"],setup:function(e,n){var a=n.emit,t=n.slots,r=f(),o=function(e){return a("change",e)},i=function(n){var a=r.value;a&&a.state.active!==n&&a.swipeTo(n,{immediate:!e.inited})};return h((function(){return e.currentIndex}),i),p((function(){i(e.currentIndex)})),function(){return s("div",{class:ce("content",{animated:e.animated||e.swipeable})},[(a=null==(n=t.default)?void 0:n.call(t),e.animated||e.swipeable?s(q,{ref:r,loop:!1,class:ce("track"),duration:1e3*+e.duration,touchable:e.swipeable,lazyRender:e.lazyRender,showIndicators:!1,onChange:o},{default:function(){return[a]}}):a)]);var n,a}}}),se=e(o("tabs"),2),ue=se[0],ve=se[1],be={type:g("line"),color:String,border:Boolean,sticky:Boolean,shrink:Boolean,active:m(0),duration:m(.3),animated:Boolean,ellipsis:c,swipeable:Boolean,scrollspy:Boolean,offsetTop:m(0),background:String,lazyRender:c,lineWidth:l,lineHeight:l,beforeChange:Function,swipeThreshold:m(5),titleActiveColor:String,titleInactiveColor:String},fe=Symbol(ue),he=i({name:ue,props:be,emits:["click","change","scroll","disabled","rendered","click-tab","update:active"],setup:function(n,t){var r,o,i,l,c,v=t.emit,b=t.slots,p=null==(o=null==(r=y())?void 0:r.vnode)?void 0:o.props;p&&"onClick"in p&&console.warn('[Vant] Tabs: "click" event is deprecated, using "click-tab" instead.'),p&&"onDisabled"in p&&console.warn('[Vant] Tabs: "disabled" event is deprecated, using "click-tab" instead.');var g=f(),m=f(),E=f(),H=P(),D=x(g),X=e(Y(),2),F=X[0],U=X[1],G=w(fe),J=G.children,Q=G.linkChildren,q=k({inited:!1,position:"",lineStyle:{},currentIndex:-1}),K=d((function(){return J.length>n.swipeThreshold||!n.ellipsis||n.shrink})),ae=d((function(){return{borderColor:n.color,background:n.background}})),te=function(e,n){var a;return null!=(a=e.name)?a:n},re=d((function(){var e=J[q.currentIndex];if(e)return te(e,q.currentIndex)})),ie=d((function(){return _(n.offsetTop)})),le=d((function(){return n.sticky?ie.value+i:0})),ce=function(e){var t=m.value,r=F.value;if(K.value&&t&&r&&r[q.currentIndex]){var o=r[q.currentIndex].$el;!function(e,n,t){var r=0,o=e.scrollLeft,i=0===t?1:Math.round(1e3*t/16);!function t(){e.scrollLeft+=(n-o)/i,++r<i&&a(t)}()}(t,o.offsetLeft-(t.offsetWidth-o.offsetWidth)/2,e?0:+n.duration)}},se=function(){var e=q.inited;I((function(){var a=F.value;if(a&&a[q.currentIndex]&&"line"===n.type&&!j(g.value)){var t=a[q.currentIndex].$el,r=n.lineWidth,o=n.lineHeight,i=t.offsetLeft+t.offsetWidth/2,l={width:R(r),backgroundColor:n.color,transform:"translateX(".concat(i,"px) translateX(-50%)")};if(e&&(l.transitionDuration="".concat(n.duration,"s")),u(o)){var c=R(o);l.height=c,l.borderRadius=c}q.lineStyle=l}}))},ue=function(e){var a=function(e){for(var n=e<q.currentIndex?-1:1;e>=0&&e<J.length;){if(!J[e].disabled)return e;e+=n}}(e);if(u(a)){var t=J[a],r=te(t,a),o=null!==q.currentIndex;q.currentIndex=a,r!==n.active&&(v("update:active",r),o&&v("change",r,t.title))}},be=function(e){var n=J.find((function(n,a){return te(n,a)===e})),a=n?J.indexOf(n):0;ue(a)},he=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(n.scrollspy){var a=J[q.currentIndex].$el;if(a&&D.value){var t=V(a,D.value)-le.value;l=!0,ne(D.value,t,e?0:+n.duration,(function(){l=!1}))}}},pe=function(e){c=e.isFixed,v("scroll",e)},ge=function(){return J.map((function(e,a){return s(oe,W({id:"".concat(H,"-").concat(a),ref:U(a),type:n.type,color:n.color,style:e.titleStyle,class:e.titleClass,shrink:n.shrink,isActive:a===q.currentIndex,controls:e.id,scrollable:K.value,activeColor:n.titleActiveColor,inactiveColor:n.titleInactiveColor,onClick:function(t){return function(e,a,t){var r=J[a],o=r.title,i=r.disabled,l=te(J[a],a);i?v("disabled",l,o):(O(n.beforeChange,{args:[l],done:function(){ue(a),he()}}),v("click",l,o),Z(e)),v("click-tab",{name:l,title:o,event:t,disabled:i})}(e,a,t)}},M(e,["dot","badge","title","disabled","showZeroBadge"])),{title:e.$slots.title})}))},me=function(){if("line"===n.type&&J.length)return s("div",{class:ve("line"),style:q.lineStyle},null)},ye=function(){var e,a,t,r,o,i=n.type,l=n.border;return s("div",{ref:E,class:[ve("wrap"),(t={},r=L,o="line"===i&&l,r in t?Object.defineProperty(t,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[r]=o,t)]},[s("div",{ref:m,role:"tablist",class:ve("nav",[i,{shrink:n.shrink,complete:K.value}]),style:ae.value,"aria-orientation":"horizontal"},[null==(e=b["nav-left"])?void 0:e.call(b),ge(),me(),null==(a=b["nav-right"])?void 0:a.call(b)])])};h([function(){return n.color},S],se),h((function(){return n.active}),(function(e){e!==re.value&&be(e)})),h((function(){return J.length}),(function(){q.inited&&(be(n.active),se(),I((function(){ce(!0)})))})),h((function(){return q.currentIndex}),(function(){ce(),se(),c&&!n.scrollspy&&$(Math.ceil(V(g.value)-ie.value))}));return C({resize:se,scrollTo:function(e){I((function(){be(e),he(!0)}))}}),B(se),z(se),A((function(){be(n.active),I((function(){q.inited=!0,E.value&&(i=N(E.value).height),ce(!0)}))})),T("scroll",(function(){if(n.scrollspy&&!l){var e=function(){for(var e=0;e<J.length;e++)if(N(J[e].$el).top>le.value)return 0===e?0:e-1;return J.length-1}();ue(e)}}),{target:D}),Q({id:H,props:n,setLine:se,onRendered:function(e,n){return v("rendered",e,n)},currentName:re,scrollIntoView:ce}),function(){var e;return s("div",{ref:g,class:ve([n.type])},[n.sticky?s(ee,{container:g.value,offsetTop:ie.value,onScroll:pe},{default:function(){var e;return[ye(),null==(e=b["nav-bottom"])?void 0:e.call(b)]}}):[ye(),null==(e=b["nav-bottom"])?void 0:e.call(b)],s(de,{count:J.length,inited:q.inited,animated:n.animated,duration:n.duration,swipeable:n.swipeable,lazyRender:n.lazyRender,currentIndex:q.currentIndex,onChange:ue},{default:function(){var e;return[null==(e=b.default)?void 0:e.call(b)]}})])}}}),pe=e(o("tab"),2),ge=pe[0],me=pe[1],ye=E({},H,{dot:Boolean,name:l,badge:l,title:String,disabled:Boolean,titleClass:D,titleStyle:[String,Object],showZeroBadge:c}),xe=i({name:ge,props:ye,setup:function(e,n){var a=n.slots,t=P(),r=f(!1),o=X(fe),i=o.parent,l=o.index;if(i){var c=function(){var n;return null!=(n=e.name)?n:l.value},u=d((function(){var n=c()===i.currentName.value;return n&&!r.value&&(r.value=!0,i.props.lazyRender&&I((function(){i.onRendered(c(),e.title)}))),n}));return h((function(){return e.title}),(function(){i.setLine(),i.scrollIntoView()})),F(Q,u),function(){var e,n="".concat(i.id,"-").concat(l.value),o=i.props,c=o.animated,d=o.swipeable,v=o.scrollspy,b=o.lazyRender;if(a.default||c){var f=v||u.value;if(c||d)return s(K,{id:t,role:"tabpanel",class:me("panel-wrapper",{inactive:!u.value}),tabindex:u.value?0:-1,"aria-hidden":!u.value,"aria-labelledby":n},{default:function(){var e;return[s("div",{class:me("panel")},[null==(e=a.default)?void 0:e.call(a)])]}});var h=r.value||v||!b?null==(e=a.default)?void 0:e.call(a):null;return C({id:t}),U(s("div",{id:t,role:"tabpanel",class:me("panel"),tabindex:f?0:-1,"aria-labelledby":n},[h]),[[G,f]])}}}console.error("[Vant] <Tab> must be a child component of <Tabs>.")}});n("a",J(xe)),n("T",J(he))}}}))}();
|