mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[new feature] Tab: add new external class nav-class、tab-class、tab-active-class
fix #1313
This commit is contained in:
parent
94e06e50f4
commit
da04fb0c1a
@ -13,7 +13,7 @@
|
|||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="自定义标题">
|
<demo-block title="自定义标题">
|
||||||
<van-tabs active="{{ 1 }}" bind:change="onChange">
|
<van-tabs active="{{ 1 }}" bind:change="onChange" tab-class="tab-class" tab-active-class="tab-active-class">
|
||||||
<van-icon
|
<van-icon
|
||||||
slot="nav-right"
|
slot="nav-right"
|
||||||
name="search"
|
name="search"
|
||||||
@ -24,7 +24,6 @@
|
|||||||
wx:for="1234"
|
wx:for="1234"
|
||||||
wx:key="index"
|
wx:key="index"
|
||||||
title="{{ '标签' + item }}"
|
title="{{ '标签' + item }}"
|
||||||
title-style="font-size: 16px; font-weight: bold; {{ index === 0 ? 'text-decoration: line-through;' : '' }}"
|
|
||||||
dot="{{ index === 1 }}"
|
dot="{{ index === 1 }}"
|
||||||
info="{{ index === 2 ? 99 : null }}"
|
info="{{ index === 2 ? 99 : null }}"
|
||||||
>
|
>
|
||||||
|
@ -11,3 +11,12 @@
|
|||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
line-height: 44px !important;
|
line-height: 44px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-class {
|
||||||
|
transition: all 0.25s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-active-class {
|
||||||
|
font-size: 1.05em !important;
|
||||||
|
color: #1989fa !important;
|
||||||
|
}
|
||||||
|
@ -203,3 +203,6 @@ Page({
|
|||||||
| 类名 | 说明 |
|
| 类名 | 说明 |
|
||||||
|-----------|-----------|
|
|-----------|-----------|
|
||||||
| custom-class | 根节点样式类 |
|
| custom-class | 根节点样式类 |
|
||||||
|
| nav-class | 标签栏样式类 |
|
||||||
|
| tab-class | 标签样式类 |
|
||||||
|
| tab-active-class | 标签激活态样式类 |
|
||||||
|
@ -110,7 +110,6 @@
|
|||||||
color: @gray-darker;
|
color: @gray-darker;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
background-color: @white;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ type Position = 'top' | 'bottom' | '';
|
|||||||
VantComponent({
|
VantComponent({
|
||||||
mixins: [touch],
|
mixins: [touch],
|
||||||
|
|
||||||
|
classes: ['nav-class', 'tab-class', 'tab-active-class', 'line-class'],
|
||||||
|
|
||||||
relation: {
|
relation: {
|
||||||
name: 'tab',
|
name: 'tab',
|
||||||
type: 'descendant',
|
type: 'descendant',
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
class="van-tabs__scroll--{{ type }}"
|
class="van-tabs__scroll--{{ type }}"
|
||||||
style="{{ color ? 'border-color: ' + color : '' }}"
|
style="{{ color ? 'border-color: ' + color : '' }}"
|
||||||
>
|
>
|
||||||
<view class="van-tabs__nav van-tabs__nav--{{ type }}">
|
<view class="{{ utils.bem('tabs__nav', [type]) }} nav-class">
|
||||||
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ lineStyle }}" />
|
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ lineStyle }}" />
|
||||||
<view
|
<view
|
||||||
wx:for="{{ tabs }}"
|
wx:for="{{ tabs }}"
|
||||||
wx:key="index"
|
wx:key="index"
|
||||||
data-index="{{ index }}"
|
data-index="{{ index }}"
|
||||||
class="van-ellipsis {{ utils.bem('tab', { active: index === active, disabled: item.disabled }) }}"
|
class="van-ellipsis tab-class {{ index === active ? 'tab-active-class' : '' }} {{ utils.bem('tab', { active: index === active, disabled: item.disabled }) }}"
|
||||||
style="{{ color && index !== active && type === 'card' && !item.disabled ? 'color: ' + color : '' }} {{ color && index === active && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }} {{ scrollable ? ';flex-basis:' + (88 / swipeThreshold) + '%' : '' }}"
|
style="{{ color && index !== active && type === 'card' && !item.disabled ? 'color: ' + color : '' }} {{ color && index === active && type === 'card' ? ';background-color:' + color : '' }} {{ color ? ';border-color: ' + color : '' }} {{ scrollable ? ';flex-basis:' + (88 / swipeThreshold) + '%' : '' }}"
|
||||||
bind:tap="onTap"
|
bind:tap="onTap"
|
||||||
>
|
>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user