mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-10-08 18:00:00 +08:00
docs(Tab): update document
This commit is contained in:
parent
e16239e426
commit
0f3cc3c633
@ -123,6 +123,7 @@ export default {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 2px 6px;
|
padding: 2px 6px;
|
||||||
color: @van-doc-blue;
|
color: @van-doc-blue;
|
||||||
|
font-weight: 500;
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
background-color: fade(@van-doc-blue, 10%);
|
background-color: fade(@van-doc-blue, 10%);
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
|
@ -176,7 +176,7 @@ In scrollspy mode, the list of content will be tiled
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<van-tabs v-model="active" scrollspy sticky>
|
<van-tabs v-model="active" scrollspy sticky>
|
||||||
<van-tab v-for="index in 10" :title="'tab ' + index">
|
<van-tab v-for="index in 8" :title="'tab ' + index">
|
||||||
content {{ index }}
|
content {{ index }}
|
||||||
</van-tab>
|
</van-tab>
|
||||||
</van-tabs>
|
</van-tabs>
|
||||||
@ -190,15 +190,11 @@ In scrollspy mode, the list of content will be tiled
|
|||||||
|------|------|------|------|
|
|------|------|------|------|
|
||||||
| v-model | Index of active tab | *string \| number* | `0` |
|
| v-model | Index of active tab | *string \| number* | `0` |
|
||||||
| type | Can be set to `line` `card` | *string* | `line` |
|
| type | Can be set to `line` `card` | *string* | `line` |
|
||||||
|
| color | Tab color | *string* | `#ee0a24` |
|
||||||
| duration | Toggle tab's animation time | *number* | `0.3` | - |
|
| duration | Toggle tab's animation time | *number* | `0.3` | - |
|
||||||
| background | Background color | *string* | `white` |
|
| background | Background color | *string* | `white` |
|
||||||
| line-width | Width of tab line | *string \| number* | Width of active tab |
|
| line-width | Width of tab line | *string \| number* | Width of active tab |
|
||||||
| line-height | Height of tab line | *string \| number* | `3px` |
|
| line-height | Height of tab line | *string \| number* | `3px` |
|
||||||
| color | Tab color | *string* | `#ee0a24` |
|
|
||||||
| title-active-color | Title active color | *string* | - |
|
|
||||||
| title-inactive-color | Title inactive color | *string* | - |
|
|
||||||
| swipe-threshold | Set swipe tabs threshold | *number* | `4` | - |
|
|
||||||
| offset-top | Offset top when use sticky mode | *number* | `0` |
|
|
||||||
| animated | Whether to change tabs with animation | *boolean* | `false` |
|
| animated | Whether to change tabs with animation | *boolean* | `false` |
|
||||||
| border | Whether to show border when `type="line"` | *boolean* | `true` |
|
| border | Whether to show border when `type="line"` | *boolean* | `true` |
|
||||||
| ellipsis | Whether to ellipsis too long title | *boolean* | `true` |
|
| ellipsis | Whether to ellipsis too long title | *boolean* | `true` |
|
||||||
@ -206,20 +202,24 @@ In scrollspy mode, the list of content will be tiled
|
|||||||
| swipeable | Whether to switch tabs with swipe gestrue in the content | *boolean* | `false` |
|
| swipeable | Whether to switch tabs with swipe gestrue in the content | *boolean* | `false` |
|
||||||
| lazy-render | Whether to enable tab content lazy render | *boolean* | `true` |
|
| lazy-render | Whether to enable tab content lazy render | *boolean* | `true` |
|
||||||
| scrollspy `v2.3.0` | Whether to use scrollspy mode | *boolean* | `false` |
|
| scrollspy `v2.3.0` | Whether to use scrollspy mode | *boolean* | `false` |
|
||||||
|
| offset-top | Offset top when use sticky mode | *number* | `0` |
|
||||||
|
| swipe-threshold | Set swipe tabs threshold | *number* | `4` | - |
|
||||||
|
| title-active-color | Title active color | *string* | - |
|
||||||
|
| title-inactive-color | Title inactive color | *string* | - |
|
||||||
|
|
||||||
### Tab Props
|
### Tab Props
|
||||||
|
|
||||||
| Attribute | Description | Type | Default |
|
| Attribute | Description | Type | Default |
|
||||||
|------|------|------|------|
|
|------|------|------|------|
|
||||||
| name | Identifier | *string \| number* | Index of tab |
|
|
||||||
| title | Title | *string* | - |
|
| title | Title | *string* | - |
|
||||||
| title-style `v2.2.14` | Custom title style | *any* | - |
|
|
||||||
| disabled | Whether to disable tab | *boolean* | `false` |
|
| disabled | Whether to disable tab | *boolean* | `false` |
|
||||||
| dot `v2.3.0` | Whether to show red dot on the title | *boolean* | `false` |
|
| dot `v2.3.0` | Whether to show red dot on the title | *boolean* | `false` |
|
||||||
| info `v2.3.0` | Content of the badge on the title | *string \| number* | - |
|
| info `v2.3.0` | Content of the badge on the title | *string \| number* | - |
|
||||||
|
| name `v2.0.6` | Identifier | *string \| number* | Index of tab |
|
||||||
| url `v2.2.1` | Link | *string* | - |
|
| url `v2.2.1` | Link | *string* | - |
|
||||||
| to `v2.2.1` | Target route of the link, same as to of vue-router | *string \| object* | - |
|
| to `v2.2.1` | Target route of the link, same as to of vue-router | *string \| object* | - |
|
||||||
| replace `v2.2.1` | If true, the navigation will not leave a history record | *boolean* | `false` |
|
| replace `v2.2.1` | If true, the navigation will not leave a history record | *boolean* | `false` |
|
||||||
|
| title-style `v2.2.14` | Custom title style | *any* | - |
|
||||||
|
|
||||||
### Tabs Events
|
### Tabs Events
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ export default {
|
|||||||
|
|
||||||
```html
|
```html
|
||||||
<van-tabs v-model="active" scrollspy sticky>
|
<van-tabs v-model="active" scrollspy sticky>
|
||||||
<van-tab v-for="index in 10" :title="'选项 ' + index">
|
<van-tab v-for="index in 8" :title="'选项 ' + index">
|
||||||
内容 {{ index }}
|
内容 {{ index }}
|
||||||
</van-tab>
|
</van-tab>
|
||||||
</van-tabs>
|
</van-tabs>
|
||||||
@ -193,16 +193,12 @@ export default {
|
|||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|------|------|------|------|
|
|------|------|------|------|
|
||||||
| v-model | 绑定当前选中标签的标识符 | *string \| number* | `0` |
|
| v-model | 绑定当前选中标签的标识符 | *string \| number* | `0` |
|
||||||
| type | 样式类型,可选值为`card` | *string* | `line` |
|
| type | 样式风格类型,可选值为`card` | *string* | `line` |
|
||||||
|
| color | 标签主题色 | *string* | `#ee0a24` |
|
||||||
| duration | 动画时间,单位秒 | *number* | `0.3` |
|
| duration | 动画时间,单位秒 | *number* | `0.3` |
|
||||||
| background | 标签栏背景色 | *string* | `white` |
|
| background | 标签栏背景色 | *string* | `white` |
|
||||||
| line-width | 底部条宽度,默认单位 px | *string \| number* | `auto` |
|
| line-width | 底部条宽度,默认单位 px | *string \| number* | `auto` |
|
||||||
| line-height | 底部条高度,默认单位 px | *string \| number* | `3px` |
|
| line-height | 底部条高度,默认单位 px | *string \| number* | `3px` |
|
||||||
| color | 标签主题色 | *string* | `#ee0a24` |
|
|
||||||
| title-active-color | 标题选中态颜色 | *string* | - |
|
|
||||||
| title-inactive-color | 标题默认态颜色 | *string* | - |
|
|
||||||
| swipe-threshold | 滚动阈值,标签数量超过多少个可滚动 | *number* | `4` |
|
|
||||||
| offset-top | 粘性定位布局下与顶部的最小距离,单位 px | *number* | `0` |
|
|
||||||
| animated | 是否开启切换标签内容时的转场动画 | *boolean* | `false` |
|
| animated | 是否开启切换标签内容时的转场动画 | *boolean* | `false` |
|
||||||
| border | 是否显示标签栏外边框,仅在`type="line"`时有效 | *boolean* | `true` |
|
| border | 是否显示标签栏外边框,仅在`type="line"`时有效 | *boolean* | `true` |
|
||||||
| ellipsis | 是否省略过长的标题文字 | *boolean* | `true` |
|
| ellipsis | 是否省略过长的标题文字 | *boolean* | `true` |
|
||||||
@ -210,20 +206,24 @@ export default {
|
|||||||
| swipeable | 是否开启手势滑动切换 | *boolean* | `false` |
|
| swipeable | 是否开启手势滑动切换 | *boolean* | `false` |
|
||||||
| lazy-render | 是否开启延迟渲染(首次切换到标签时才触发内容渲染) | *boolean* | `true` |
|
| lazy-render | 是否开启延迟渲染(首次切换到标签时才触发内容渲染) | *boolean* | `true` |
|
||||||
| scrollspy `v2.3.0` | 是否开启滚动导航 | *boolean* | `false` |
|
| scrollspy `v2.3.0` | 是否开启滚动导航 | *boolean* | `false` |
|
||||||
|
| offset-top | 粘性定位布局下与顶部的最小距离,单位 px | *number* | `0` |
|
||||||
|
| swipe-threshold | 滚动阈值,标签数量超过阈值时开始横向滚动 | *number* | `4` |
|
||||||
|
| title-active-color | 标题选中态颜色 | *string* | - |
|
||||||
|
| title-inactive-color | 标题默认态颜色 | *string* | - |
|
||||||
|
|
||||||
### Tab Props
|
### Tab Props
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|------|------|------|------|
|
|------|------|------|------|
|
||||||
| name `v2.0.6` | 标签名称,作为匹配的标识符 | *string \| number* | 标签的索引值 |
|
|
||||||
| title | 标题 | *string* | - |
|
| title | 标题 | *string* | - |
|
||||||
| title-style `v2.2.14` | 自定义标题样式 | *any* | - |
|
|
||||||
| disabled | 是否禁用标签 | *boolean* | `false` |
|
| disabled | 是否禁用标签 | *boolean* | `false` |
|
||||||
| dot `v2.3.0` | 是否在标题右上角显示小红点 | *boolean* | `false` |
|
| dot `v2.3.0` | 是否在标题右上角显示小红点 | *boolean* | `false` |
|
||||||
| info `v2.3.0` | 标题右上角徽标的内容 | *string \| number* | - |
|
| info `v2.3.0` | 标题右上角徽标的内容 | *string \| number* | - |
|
||||||
|
| name `v2.0.6` | 标签名称,作为匹配的标识符 | *string \| number* | 标签的索引值 |
|
||||||
| url `v2.2.1` | 点击后跳转的链接地址 | *string* | - |
|
| url `v2.2.1` | 点击后跳转的链接地址 | *string* | - |
|
||||||
| to `v2.2.1` | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - |
|
| to `v2.2.1` | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - |
|
||||||
| replace `v2.2.1` | 是否在跳转时替换当前页面历史 | *boolean* | `false` |
|
| replace `v2.2.1` | 是否在跳转时替换当前页面历史 | *boolean* | `false` |
|
||||||
|
| title-style `v2.2.14` | 自定义标题样式 | *any* | - |
|
||||||
|
|
||||||
### Tabs Events
|
### Tabs Events
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
<demo-block v-if="!isWeapp" :title="$t('title10')">
|
<demo-block v-if="!isWeapp" :title="$t('title10')">
|
||||||
<van-tabs scrollspy sticky>
|
<van-tabs scrollspy sticky>
|
||||||
<van-tab :title="$t('tab') + index" v-for="index in 10" :key="index">
|
<van-tab :title="$t('tab') + index" v-for="index in 8" :key="index">
|
||||||
{{ $t('content') }} {{ index }}
|
{{ $t('content') }} {{ index }}
|
||||||
</van-tab>
|
</van-tab>
|
||||||
</van-tabs>
|
</van-tabs>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user