Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
b20688185c
2 changed files with 14 additions and 2 deletions
  1. 14
      components/tabi/index.wxml
  2. 2
      pages/moment/information/index.js

14
components/tabi/index.wxml

@ -1,7 +1,7 @@
<scroll-view class="scroll-view" style="height: {{size}}rpx;" scroll-x="{{scrolling}}" scroll-with-animation="{{scrolling}}" scroll-left="{{scrollLeft}}">
<view class="tabs-wrap">
<view class="tabs {{scroll ? 'tabs--scroll' : ''}}" style="height: {{size}}rpx">
<view class="tabs__item {{index === tabIndex ? 'tabs__item--cur': ''}}" style="height: {{size}}rpx;line-height: {{size}}rpx;padding: 0 {{lineType==1?4:12}}rpx;" wx:for="{{tabData}}" wx:key="*this" bindtap="toggleTab" data-index="{{index}}">
<view class="tabs__item {{index === tabIndex ? 'tabs__item--cur': ''}}" style="height: {{size}}rpx;line-height: {{size}}rpx;padding: 0 {{padding(lineType,scroll)}}rpx;" wx:for="{{tabData}}" wx:key="*this" bindtap="toggleTab" data-index="{{index}}">
<view class="tabs__item-child {{lineType == 1?'tabs-type': ''}} {{typeActive(lineType, tabIndex, index)}}">{{item}}</view>
</view>
<view class="tabs__line {{needTransition ? 'transition' : ''}}" style="background: {{color}};width: {{lineWidth}}px;transform: translateX({{translateX}}px);height: {{lineHeight}}px" wx:if="{{lineType == 0}}"></view>
@ -17,4 +17,16 @@
return tabIndex == index ? 'type--cur' : ''
}
module.exports = typeActive
</wxs>
<wxs module="padding">
function padding(lineType, scroll) {
if (lineType == 1) {
return 4
} else if(scroll && lineType !== 1) {
return 32
} else {
return 12
}
}
module.exports = padding
</wxs>

2
pages/moment/information/index.js

@ -42,7 +42,7 @@ Component({
for (let index = 0; index < this.data.typeList.length; index++) {
this.data.tabList.push(this.data.typeList[index].name)
}
this.setData({ tabList: this.data.tabList, scrolled: this.data.typeList.length >= 6 })
this.setData({ tabList: this.data.tabList, scrolled: this.data.typeList.length >= 5 })
})
},
onTabChange: function ({ detail }) {

Loading…
Cancel
Save