vant-weapp/packages/tab/index.wxml
kobeCristiano 541517361b [refactor] Tab:升级到自定义组件 (#161)
* [improvement] Tab:升级到自定义组件

* fix: 去除冗余example代码

* [refactor] 重构badge为自定义组件 (#160)

* fix: 去除tab组件使用对象入参方式,修改example用例
2018-03-25 11:10:09 +08:00

48 lines
1.2 KiB
Plaintext

<view
class="zan-tab"
style="{{ height ? 'height:' + height + 'px' : '' }}"
>
<block wx:if="{{ scroll }}">
<scroll-view
class="zan-tab__bd zan-tab__bd--scroll {{ fixed ? 'zan-tab__bd--fixed' : '' }}"
scroll-x="true"
style="height: {{ height ? height + 'px' : 'auto' }}"
>
<template
is="zan-tab-list"
data="{{ list, currentTab, 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, currentTab, height }}"
/>
</view>
</block>
</view>
<!-- 插入内容 -->
<slot></slot>
<template name="zan-tab-list">
<view
wx:for="{{ list }}"
wx:key="id"
class="zan-tab__item {{ currentTab == item.id ? 'zan-tab__item--selected' : '' }}"
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>