water_xcx/miniprogram_npm/tdesign-miniprogram/tabs/tabs.wxml

54 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

2025-04-15 15:44:51 +08:00
<wxs src="./tabs.wxs" module="filters" />
<view class="{{classPrefix}} {{classPrefix}}--{{placement}} {{prefix}}-class">
<t-sticky
t-class="{{classPrefix}}__sticky {{classPrefix}}__sticky--{{placement}}"
disabled="{{ !sticky }}"
z-index="{{ stickyProps.zIndex || '1' }}"
offset-top="{{ stickyProps.offsetTop }}"
container="{{ stickyProps.container }}"
bind:scroll="onTouchScroll"
>
<view class="{{classPrefix}}__wrapper">
<scroll-view
class="{{classPrefix}}__scroll {{classPrefix}}__scroll--{{placement}}"
enable-flex
scroll-left="{{offset}}"
scroll-x="{{isScrollX}}"
scroll-y="{{isScrollY}}"
scroll-with-animation
>
<view class="{{classPrefix}}__nav {{classPrefix}}__nav--{{placement}}">
<view
wx:for="{{tabs}}"
wx:key="index"
data-index="{{index}}"
class="{{classPrefix}}__item {{classPrefix}}__item--{{placement}} {{prefix}}-class-item {{item.disabled ? (prefix + '-is-disabled') : '' }} {{currentIndex === index ? prefix + '-is-active ' + prefix + '-class-active' : ''}}"
bind:tap="onTabTap"
>
{{item.label}}
</view>
<view
class="{{classPrefix}}__track {{classPrefix}}__track--{{placement}} {{prefix}}-class-track"
style="{{trackStyle}}"
/>
</view>
</scroll-view>
</view>
</t-sticky>
<view
class="{{classPrefix}}__content"
bind:touchstart="onTouchStart"
bind:touchmove="onTouchMove"
bind:touchend="onTouchEnd"
bind:touchcancel="onTouchEnd"
>
<view
class="{{classPrefix}}__content-inner "
style="{{ filters.animate({duration: animate.duration,currentIndex:currentIndex, direction}) }}"
>
<slot />
</view>
</view>
</view>