|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["node-modules/uview-ui/components/u-tabs/u-tabs"],{518:function(t,e,n){"use strict";n.r(e);var r=n(519),i=n(521);for(var o in i)"default"!==o&&function(t){n.d(e,t,(function(){return i[t]}))}(o);n(524);var u,c=n(15),s=Object(c["default"])(i["default"],r["render"],r["staticRenderFns"],!1,null,"0de61367",null,!1,r["components"],u);s.options.__file="node_modules/uview-ui/components/u-tabs/u-tabs.vue",e["default"]=s.exports},519:function(t,e,n){"use strict";n.r(e);var r=n(520);n.d(e,"render",(function(){return r["render"]})),n.d(e,"staticRenderFns",(function(){return r["staticRenderFns"]})),n.d(e,"recyclableRender",(function(){return r["recyclableRender"]})),n.d(e,"components",(function(){return r["components"]}))},520:function(t,e,n){"use strict";var r;n.r(e),n.d(e,"render",(function(){return i})),n.d(e,"staticRenderFns",(function(){return u})),n.d(e,"recyclableRender",(function(){return o})),n.d(e,"components",(function(){return r}));try{r={uBadge:function(){return Promise.all([n.e("common/vendor"),n.e("node-modules/uview-ui/components/u-badge/u-badge")]).then(n.bind(null,650))}}}catch(c){if(-1===c.message.indexOf("Cannot find module")||-1===c.message.indexOf(".vue"))throw c;console.error(c.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var i=function(){var t=this,e=t.$createElement,n=(t._self._c,t.__get_style([t.$u.addStyle(t.itemStyle),{flex:t.scrollable?"":1}])),r=t.__map(t.list,(function(e,n){var r=t.__get_orig(e),i=t.__get_style([t.textStyle(n)]);return{$orig:r,s1:i}})),i=t.$u.addUnit(t.lineWidth),o=t.$u.addUnit(t.lineHeight);t.$mp.data=Object.assign({},{$root:{s0:n,l0:r,g0:i,g1:o}})},o=!1,u=[];i._withStripped=!0},521:function(t,e,n){"use strict";n.r(e);var r=n(522),i=n.n(r);for(var o in r)"default"!==o&&function(t){n.d(e,t,(function(){return r[t]}))}(o);e["default"]=i.a},522:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=o(n(38)),i=o(n(523));function o(t){return t&&t.__esModule?t:{default:t}}function u(t,e){return f(t)||l(t,e)||s(t,e)||c()}function c(){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 s(t,e){if(t){if("string"===typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function l(t,e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,o=void 0;try{for(var u,c=t[Symbol.iterator]();!(r=(u=c.next()).done);r=!0)if(n.push(u.value),e&&n.length===e)break}catch(s){i=!0,o=s}finally{try{r||null==c["return"]||c["return"]()}finally{if(i)throw o}}return n}}function f(t){if(Array.isArray(t))return t}function d(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function h(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?d(Object(n),!0).forEach((function(e){m(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p(t,e,n,r,i,o,u){try{var c=t[o](u),s=c.value}catch(a){return void n(a)}c.done?e(s):Promise.resolve(s).then(r,i)}function v(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function u(t){p(o,r,i,u,c,"next",t)}function c(t){p(o,r,i,u,c,"throw",t)}u(void 0)}))}}var b={name:"u-tabs",mixins:[t.$u.mpMixin,t.$u.mixin,i.default],data:function(){return{firstTime:!0,scrollLeft:0,scrollViewWidth:0,lineOffsetLeft:0,tabsRect:{left:0},innerCurrent:0,moving:!1}},watch:{current:{immediate:!0,handler:function(t,e){var n=this;t!==this.innerCurrent&&(this.innerCurrent=t,this.$nextTick((function(){n.resize()})))}},list:function(){var t=this;this.$nextTick((function(){t.resize()}))}},computed:{textStyle:function(){var e=this;return function(n){var r={},i=n===e.innerCurrent?t.$u.addStyle(e.activeStyle):t.$u.addStyle(e.inactiveStyle);return e.list[n].disabled&&(r.color="#c8c9cc"),t.$u.deepMerge(i,r)}},propsBadge:function(){return t.$u.props.badge}},mounted:function(){var t=this;return v(r.default.mark((function e(){return r.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t.init();case 1:case"end":return e.stop()}}),e)})))()},methods:{setLineLeft:function(){var e=this,n=this.list[this.innerCurrent];if(n){var r=this.list.slice(0,this.innerCurrent).reduce((function(t,e){return t+e.rect.width}),0),i=t.$u.getPx(this.lineWidth);this.lineOffsetLeft=r+(n.rect.width-i)/2,this.firstTime&&setTimeout((function(){e.firstTime=!1}),10)}},animation:function(t){},clickHandler:function(t,e){this.$emit("click",h(h({},t),{},{index:e})),t.disabled||(this.innerCurrent=e,this.resize(),this.$emit("change",h(h({},t),{},{index:e})))},init:function(){var e=this;t.$u.sleep().then((function(){e.resize()}))},setScrollLeft:function(){var e=this.list[this.innerCurrent],n=this.list.slice(0,this.innerCurrent).reduce((function(t,e){return t+e.rect.width}),0),r=t.$u.sys().windowWidth,i=n-(this.tabsRect.width-e.rect.width)/2-(r-this.tabsRect.right)/2+this.tabsRect.left/2;i=Math.min(i,this.scrollViewWidth-this.tabsRect.width),this.scrollLeft=Math.max(0,i)},resize:function(){var t=this;0!==this.list.length&&Promise.all([this.getTabsRect(),this.getAllItemRect()]).then((function(e){var n=u(e,2),r=n[0],i=n[1],o=void 0===i?[]:i;t.tabsRect=r,t.scrollViewWidth=0,o.map((function(e,n){t.scrollViewWidth+=e.width,t.list[n].rect=e})),t.setLineLeft(),t.setScrollLeft()}))},getTabsRect:function(){var t=this;return new Promise((function(e){t.queryRect("u-tabs__wrapper__scroll-view").then((function(t){return e(t)}))}))},getAllItemRect:function(){var t=this;return new Promise((function(e){var n=t.list.map((function(e,n){return t.queryRect("u-tabs__wrapper__nav__item-".concat(n),!0)}));Promise.all(n).then((function(t){return e(t)}))}))},queryRect:function(t,e){var n=this;return new Promise((function(e){n.$uGetRect(".".concat(t)).then((function(t){e(t)}))}))}}};e.default=b}).call(this,n(1)["default"])},524:function(t,e,n){"use strict";n.r(e);var r=n(525),i=n.n(r);for(var o in r)"default"!==o&&function(t){n.d(e,t,(function(){return r[t]}))}(o);e["default"]=i.a},525:function(t,e,n){}}]);
|