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(["./ResizeObserver.es-legacy.44b91b4c.js","./use-id-legacy.ef8b5e97.js","./use-tab-status-legacy.d7434e0b.js","./index-legacy.9d5cae73.js","./use-refs-legacy.d925b49f.js","./index-legacy.3ccba950.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,z,B,A,T,j,R,L,O,M,V,W,$,Z,E,H,N,D,F,X,U,G,J,K,P,Y,q,Q,ee;return{setters:[function(e){a=e.au,t=e.ah,r=e.av,o=e.E,i=e.d,l=e.G,c=e.H,d=e.W,s=e.j,u=e.M,v=e.aw,b=e.ax,f=e.U,h=e.a3,p=e.V,g=e.a0,m=e.ab,y=e.a1,x=e.ac,w=e.aj,k=e.S,_=e.ad,S=e.al,I=e.X,C=e.ak,z=e.ao,B=e.ap,A=e.aa,T=e.af,j=e.ag,R=e.a2,L=e.ay,O=e.az,M=e.aA,V=e.Y,W=e.a8,$=e.aB,Z=e.aC,E=e.aD,H=e.J,N=e.K,D=e.I,F=e.at,X=e.aE,U=e.a6,G=e.aF,J=e.O},function(e){K=e.u},function(e){P=e.T},function(e){Y=e.S,q=e.a},function(e){Q=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(Y,{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(),H=f(),N=K(),D=x(g),F=e(Q(),2),X=F[0],U=F[1],G=w(fe),J=G.children,P=G.linkChildren,Y=k({inited:!1,position:"",lineStyle:{},currentIndex:-1}),q=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[Y.currentIndex];if(e)return te(e,Y.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=X.value;if(q.value&&t&&r&&r[Y.currentIndex]){var o=r[Y.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=Y.inited;I((function(){var a=X.value;if(a&&a[Y.currentIndex]&&"line"===n.type&&!j(g.value)){var t=a[Y.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}Y.lineStyle=l}}))},ue=function(e){var a=function(e){for(var n=e<Y.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!==Y.currentIndex;Y.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[Y.currentIndex].$el;if(a&&D.value){var t=M(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(N,"-").concat(a),ref:U(a),type:n.type,color:n.color,style:e.titleStyle,class:e.titleClass,shrink:n.shrink,isActive:a===Y.currentIndex,controls:e.id,scrollable:q.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):(Z(n.beforeChange,{args:[l],done:function(){ue(a),he()}}),v("click",l,o),E(e)),v("click-tab",{name:l,title:o,event:t,disabled:i})}(e,a,t)}},$(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:Y.lineStyle},null)},ye=function(){var e,a,t,r,o,i=n.type,l=n.border;return s("div",{ref:H,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:q.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(){Y.inited&&(be(n.active),se(),I((function(){ce(!0)})))})),h((function(){return Y.currentIndex}),(function(){ce(),se(),c&&!n.scrollspy&&O(Math.ceil(M(g.value)-ie.value))}));return C({resize:se,scrollTo:function(e){I((function(){be(e),he(!0)}))}}),z(se),B(se),A((function(){be(n.active),I((function(){Y.inited=!0,H.value&&(i=V(H.value).height),ce(!0)}))})),T("scroll",(function(){if(n.scrollspy&&!l){var e=function(){for(var e=0;e<J.length;e++)if(V(J[e].$el).top>le.value)return 0===e?0:e-1;return J.length-1}();ue(e)}}),{target:D}),P({id:N,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:Y.inited,animated:n.animated,duration:n.duration,swipeable:n.swipeable,lazyRender:n.lazyRender,currentIndex:Y.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=H({},N,{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=K(),r=f(!1),o=F(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()})),X(P,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(q,{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))}}}))}();
|