| 1234567891011 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["uview-ui/components/u-tabs/u-tabs"],{1207:function(t,e,n){"use strict";n.r(e);var r=n(1208),i=n(1210);for(var o in i)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(o);n(1212);var a,u=n(32),c=Object(u["default"])(i["default"],r["render"],r["staticRenderFns"],!1,null,"3b2b1a80",null,!1,r["components"],a);c.options.__file="uview-ui/components/u-tabs/u-tabs.vue",e["default"]=c.exports},1208:function(t,e,n){"use strict";n.r(e);var r=n(1209);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"]}))},1209:function(t,e,n){"use strict";var r;n.r(e),n.d(e,"render",(function(){return i})),n.d(e,"staticRenderFns",(function(){return a})),n.d(e,"recyclableRender",(function(){return o})),n.d(e,"components",(function(){return r}));try{r={uBadge:function(){return n.e("uview-ui/components/u-badge/u-badge").then(n.bind(null,1508))}}}catch(u){if(-1===u.message.indexOf("Cannot find module")||-1===u.message.indexOf(".vue"))throw u;console.error(u.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.__map(t.list,(function(e,n){var r=t.__get_orig(e),i=t.__get_style([t.tabItemStyle(n)]);return{$orig:r,s0:i}}))),r=t.showBar?t.__get_style([t.tabBarStyle]):null;t.$mp.data=Object.assign({},{$root:{l0:n,s1:r}})},o=!1,a=[];i._withStripped=!0},1210:function(t,e,n){"use strict";n.r(e);var r=n(1211),i=n.n(r);for(var o in r)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);e["default"]=i.a},1211:function(t,e,n){"use strict";(function(t){var r=n(4);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=r(n(41)),o=r(n(43)),a={name:"u-tabs",props:{isScroll:{type:Boolean,default:!0},list:{type:Array,default:function(){return[]}},current:{type:[Number,String],default:0},height:{type:[String,Number],default:80},fontSize:{type:[String,Number],default:30},duration:{type:[String,Number],default:.5},activeColor:{type:String,default:"#2979ff"},inactiveColor:{type:String,default:"#303133"},barWidth:{type:[String,Number],default:40},barHeight:{type:[String,Number],default:6},gutter:{type:[String,Number],default:30},bgColor:{type:String,default:"#ffffff"},name:{type:String,default:"name"},count:{type:String,default:"count"},offset:{type:Array,default:function(){return[5,20]}},bold:{type:Boolean,default:!0},activeItemStyle:{type:Object,default:function(){return{}}},showBar:{type:Boolean,default:!0},barStyle:{type:Object,default:function(){return{}}},itemWidth:{type:[Number,String],default:"auto"}},data:function(){return{scrollLeft:0,tabQueryInfo:[],componentWidth:0,scrollBarLeft:0,parentLeft:0,id:this.$u.guid(),currentIndex:this.current,barFirstTimeMove:!0}},watch:{list:function(t,e){var n=this;t.length!==e.length&&(this.currentIndex=0),this.$nextTick((function(){n.init()}))},current:{immediate:!0,handler:function(t,e){var n=this;this.$nextTick((function(){n.currentIndex=t,n.scrollByIndex()}))}}},computed:{tabBarStyle:function(){var t={width:this.barWidth+"rpx",transform:"translate(".concat(this.scrollBarLeft,"px, -100%)"),"transition-duration":"".concat(this.barFirstTimeMove?0:this.duration,"s"),"background-color":this.activeColor,height:this.barHeight+"rpx","border-radius":"".concat(this.barHeight/2,"px")};return Object.assign(t,this.barStyle),t},tabItemStyle:function(){var t=this;return function(e){var n={height:t.height+"rpx","line-height":t.height+"rpx","font-size":t.fontSize+"rpx","transition-duration":"".concat(t.duration,"s"),padding:t.isScroll?"0 ".concat(t.gutter,"rpx"):"",flex:t.isScroll?"auto":"1",width:t.$u.addUnit(t.itemWidth)};return e==t.currentIndex&&t.bold&&(n.fontWeight="bold"),e==t.currentIndex?(n.color=t.activeColor,n=Object.assign(n,t.activeItemStyle)):n.color=t.inactiveColor,n}}},methods:{init:function(){var t=this;return(0,o.default)(i.default.mark((function e(){var n;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,t.$uGetRect("#"+t.id);case 2:n=e.sent,t.parentLeft=n.left,t.componentWidth=n.width,t.getTabRect();case 6:case"end":return e.stop()}}),e)})))()},clickTab:function(t){t!=this.currentIndex&&this.$emit("change",t)},getTabRect:function(){for(var e=t.createSelectorQuery().in(this),n=0;n<this.list.length;n++)e.select("#u-tab-item-".concat(n)).fields({size:!0,rect:!0});e.exec(function(t){this.tabQueryInfo=t,this.scrollByIndex()}.bind(this))},scrollByIndex:function(){var e=this,n=this.tabQueryInfo[this.currentIndex];if(n){var r=n.width,i=n.left-this.parentLeft,o=i-(this.componentWidth-r)/2;this.scrollLeft=o<0?0:o;var a=n.left+n.width/2-this.parentLeft;this.scrollBarLeft=a-t.upx2px(this.barWidth)/2,1==this.barFirstTimeMove&&setTimeout((function(){e.barFirstTimeMove=!1}),100)}}},mounted:function(){this.init()}};e.default=a}).call(this,n(2)["default"])},1212:function(t,e,n){"use strict";n.r(e);var r=n(1213),i=n.n(r);for(var o in r)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(o);e["default"]=i.a},1213:function(t,e,n){}}]);
- //# sourceMappingURL=../../../../.sourcemap/mp-weixin/uview-ui/components/u-tabs/u-tabs.js.map
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'uview-ui/components/u-tabs/u-tabs-create-component',
- {
- 'uview-ui/components/u-tabs/u-tabs-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('2')['createComponent'](__webpack_require__(1207))
- })
- },
- [['uview-ui/components/u-tabs/u-tabs-create-component']]
- ]);
|