[improvement] Tab: optimize wxml (#860)

This commit is contained in:
neverland 2018-11-06 16:02:23 +08:00 committed by GitHub
parent fbefab3972
commit c88e8e02e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -50,7 +50,7 @@
.van-tab { .van-tab {
color: @red; color: @red;
border-right: 1px solid @red; border-right: 1px solid @red;
line-height: @van-tabs-card-height - 2px; line-height: @van-tabs-card-height;
&:last-child { &:last-child {
border-right: none; border-right: none;

View File

@ -13,16 +13,14 @@
wx:for="{{ tabs }}" wx:for="{{ tabs }}"
wx:key="index" wx:key="index"
data-index="{{ index }}" data-index="{{ index }}"
class="van-tab {{ index === active ? 'van-tab--active' : '' }} {{ item.data.disabled ? 'van-tab--disabled' : '' }}" class="van-ellipsis van-tab {{ index === active ? 'van-tab--active' : '' }} {{ item.data.disabled ? 'van-tab--disabled' : '' }}"
style="{{ color && (index === active) !== (type === 'card') && !item.data.disabled ? 'color: ' + color : '' }} {{ color && index === active && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }}" style="{{ color && (index === active) !== (type === 'card') && !item.data.disabled ? 'color: ' + color : '' }} {{ color && index === active && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }}"
bind:tap="onTap" bind:tap="onTap"
> >
<view class="van-ellipsis">{{ item.data.title }}</view> {{ item.data.title }}
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<view class="van-tabs__content"> <slot />
<slot />
</view>
</view> </view>