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

* fix: 去除冗余example代码

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

* fix: 去除tab组件使用对象入参方式,修改example用例

* refactor: 重构noticebar组件

* fix: 去除tab组件冗余属性字段

* refactor: 重构toptips为自定义组件
2018-03-28 15:12:03 +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, 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' : '' }}"
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>