mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
52 lines
1.3 KiB
Plaintext
52 lines
1.3 KiB
Plaintext
<view
|
|
class="zan-tab"
|
|
style="{{ height ? 'height:' + height + 'px' : '' }}"
|
|
>
|
|
<block wx:if="{{ scroll }}">
|
|
<scroll-view
|
|
id="scroll-view"
|
|
class="zan-tab__bd zan-tab__bd--scroll {{ fixed ? 'zan-tab__bd--fixed' : '' }}"
|
|
scroll-x
|
|
scroll-with-animation
|
|
scroll-left="{{ scrollLeft }}"
|
|
style="height: {{ height ? height + 'px' : 'auto' }}"
|
|
>
|
|
<template
|
|
is="zan-tab-list"
|
|
data="{{ list, selectedId, height }}"
|
|
/>
|
|
</scroll-view>
|
|
</block>
|
|
<block wx:else>
|
|
<view
|
|
class="zan-tab__bd {{ fixed ? 'zan-tab__bd--fixed' : '' }}"
|
|
style="height: {{ height ? height + 'px' : 'auto' }}"
|
|
>
|
|
<template
|
|
is="zan-tab-list"
|
|
data="{{ list, selectedId, height }}"
|
|
/>
|
|
</view>
|
|
</block>
|
|
</view>
|
|
<!-- 插入内容 -->
|
|
<slot></slot>
|
|
|
|
<template name="zan-tab-list">
|
|
<view
|
|
wx:for="{{ list }}"
|
|
wx:key="id"
|
|
class="zan-tab__item {{ selectedId == item.id ? 'zan-tab__item--selected' : '' }}"
|
|
id="item-{{ item.id }}"
|
|
data-item-id="{{ item.id }}"
|
|
bindtap="_handleZanTabChange"
|
|
>
|
|
<view
|
|
class="zan-tab__title"
|
|
style="{{ height ? 'height:' + height + 'px;line-height:' + height + 'px' : '' }}"
|
|
>
|
|
{{ item.title }}
|
|
</view>
|
|
</view>
|
|
</template>
|