vant-weapp/packages/tab/index.wxml
Yao 7467a30020
[bug fix] Tab: 修复不滚动情况下,文字过长显示问题 (#81)
* format code

* 更改传参方式 && 增加无滚动时文字过长处理

* 增加 helper 文档

* update helper doc

* update helper doc
2017-12-16 20:57:25 +08:00

38 lines
1.2 KiB
Plaintext

<template name="zan-tab">
<view class="zan-tab">
<block wx:if="{{ tab.scroll || scroll }}">
<scroll-view
class="zan-tab__bd zan-tab__bd--scroll {{ fixed ? 'zan-tab__bd--fixed' : '' }}"
scroll-x="true"
style="height: {{ tab.height || height ? ((tab.height || height) + 'px') : 'auto' }}"
>
<template
is="zan-tab-list"
data="{{ list: tab.list || list, selectedId: tab.selectedId || selectedId, componentId }}">
</template>
</scroll-view>
</block>
<block wx:else>
<view class="zan-tab__bd {{ fixed ? 'zan-tab__bd--fixed' : '' }}">
<template
is="zan-tab-list"
data="{{ list: tab.list || list, selectedId: tab.selectedId || selectedId, componentId }}">
</template>
</view>
</block>
</view>
</template>
<template name="zan-tab-list">
<view
wx:for="{{ list }}"
wx:key="id"
class="zan-tab__item {{ selectedId == item.id ? 'zan-tab__item--selected' : '' }}"
data-component-id="{{ componentId }}"
data-item-id="{{ item.id }}"
bindtap="_handleZanTabChange"
>
<view class="zan-tab__title">{{ item.title }}</view>
</view>
</template>