index.wxml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <view class="l-tabs l-placement-top l-tabs-horizontal {{aminmated ? 'l-aminmated' :''}} {{scrollable ? 'l-tabs-scroll':''}}">
  2. <template is="tab-header" data="{{tab:tabList,placemanet,scrollable,transformY,transformX,activeKey,hasLine,activeColor,inactiveColor,headerType:'tab'}}"></template>
  3. <view class="l-tabs l-sub-placement-left l-tabs-vertical {{aminmated ? 'l-aminmated' :''}} {{scrollable ? 'l-tabs-scroll':''}}">
  4. <template is="tab-header" wx:if="{{tabList[currentIndex].subTabs.length}}" data="{{tab:tabList[currentIndex].subTabs,placemanet,scrollable,transformY,transformX,activeKey:tabList[currentIndex].activeSubKey,hasLine,activeColor,inactiveColor,headerType:'subTab'}}"></template>
  5. <view class="l-tabs-main">
  6. <view wx:if="{{!swipeable}}" class="l-tabpanel-content l-content-class">
  7. <view class="l-tabpanel {{item.key===activeKey?'l-tabpanel-active':'l-tabpanel-inactive'}}" wx:for="{{tabList}}" wx:key="key" style="{{placement=='left'||placement=='right' ? 'position:absolute;width:100%;height:100%;transform:translate(0,'+ 100 * index +'%) translateZ(0px);':''}}">
  8. <view class="l-subpanel-content" wx:if="{{item.subTabs.length>0}}" style="{{'transform:translate(0,'+ -100 * item.subCurrentIndex +'%) translateZ(0px);'}}">
  9. <view class="l-subpanel" wx:for="{{item.subTabs}}" wx:for-item="tab" wx:key="key">
  10. <slot name="{{tab.key}}"></slot>
  11. </view>
  12. </view>
  13. <slot name="{{item.key}}" wx:else></slot>
  14. </view>
  15. </view>
  16. <swiper wx:else class="l-tabpanel-content l-content-class" bindchange="swiperChange" current="{{currentIndex}}">
  17. <swiper-item class="l-tabpanel {{item.key===activeKey?'l-tabpanel-active':''}}" wx:for="{{tabList}}" wx:key="key">
  18. <view wx:if="{{item.subTabs.length>0}}">
  19. <swiper class="" vertical bindchange="subSwiperChange" current="{{item.subCurrentIndex}}">
  20. <swiper-item wx:for="{{item.subTabs}}" wx:for-item="tab" wx:key="key">
  21. <slot name="{{tab.key}}"></slot>
  22. </swiper-item>
  23. </swiper>
  24. </view>
  25. <slot name="{{item.key}}" wx:else></slot>
  26. </swiper-item>
  27. </swiper>
  28. </view>
  29. </view>
  30. </view>
  31. <template name="tab-header">
  32. <scroll-view scroll-x="{{headerType==='tab' && scrollable}}" scroll-y="{{headerType==='subTab' && scrollable}}" scroll-top="{{transformY}}" scroll-left="{{transformX}}" scroll-with-animation class="l-tabsscroll">
  33. <view class="l-tabs-header l-class-header l-header-class {{hasLine?'l-tabs-header-line':''}}">
  34. <view id="{{item.key}}" class="l-tabs-item {{item.key===activeKey ?'l-class-active l-active-class l-tabs-active':'l-class-inactive l-inactive-class l-tabs-inactive'}} {{'l-tab-image-placement-'+item.image.placement}}" style="color:{{item.key===activeKey?activeColor:inactiveColor}}" wx:for="{{tab}}" wx:key="key" data-key="{{item.key}}" data-index="{{index}}" data-header-type="{{headerType}}" mut-bind:tap="handleChange">
  35. <image wx:if="{{ item.image.activeImage || item.image.defaultImage }}" src="{{item.key===activeKey? item.image.activeImage:item.image.defaultImage}}" class="l-tab-image l-class-tabimage l-tabimage-class"/>
  36. <l-icon wx:if="{{item.icon}}" l-class="{{item.key===activeKey ? 'l-icon-active':'l-icon-inactive'}}" name="{{item.icon}}" size="28" color="{{item.key===activeKey?activeColor:inactiveColor}}"/>
  37. {{item.tab}}
  38. <view class="l-tab-line l-class-line l-line-class" wx:if="{{hasLine && item.key===activeKey}}" style="background:{{item.key===activeKey?activeColor:inactiveColor}}"></view>
  39. </view>
  40. </view>
  41. </scroll-view>
  42. </template>