docs: prettier all markdown files
This commit is contained in:
+50
-52
@@ -28,10 +28,10 @@ The first tab is actived by default, you can set `v-model` to active specified t
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 2
|
||||
active: 2,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Match By Name
|
||||
@@ -48,10 +48,10 @@ export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeName: 'a'
|
||||
activeName: 'a',
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### Swipe Tabs
|
||||
@@ -68,7 +68,7 @@ By default more than 4 tabs, you can scroll through the tabs. You can set `swipe
|
||||
|
||||
### Disabled Tab
|
||||
|
||||
You can set `disabled` attribute on the corresponding `van-tab`.
|
||||
You can set `disabled` attribute on the corresponding `van-tab`.
|
||||
|
||||
```html
|
||||
<van-tabs @disabled="onClickDisabled">
|
||||
@@ -85,8 +85,8 @@ export default {
|
||||
methods: {
|
||||
onClickDisabled(name, title) {
|
||||
Toast(title + ' is disabled');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@@ -119,8 +119,8 @@ export default {
|
||||
methods: {
|
||||
onClick(name, title) {
|
||||
Toast(title);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@@ -143,9 +143,7 @@ Use title slot to custom tab title
|
||||
```html
|
||||
<van-tabs v-model="active">
|
||||
<van-tab v-for="index in 2" :key="index">
|
||||
<template #title>
|
||||
<van-icon name="more-o" />tab
|
||||
</template>
|
||||
<template #title> <van-icon name="more-o" />tab </template>
|
||||
content {{ index }}
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
@@ -192,44 +190,44 @@ In scrollspy mode, the list of content will be tiled
|
||||
### Tabs Props
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| v-model | Index of active tab | *number \| string* | `0` |
|
||||
| type | Can be set to `line` `card` | *string* | `line` |
|
||||
| color | Tab color | *string* | `#ee0a24` |
|
||||
| background | Background color | *string* | `white` |
|
||||
| duration | Toggle tab's animation time | *number \| string* | `0.3` | - |
|
||||
| line-width | Width of tab line | *number \| string* | Width of active tab |
|
||||
| line-height | Height of tab line | *number \| string* | `3px` |
|
||||
| animated | Whether to change tabs with animation | *boolean* | `false` |
|
||||
| border | Whether to show border when `type="line"` | *boolean* | `true` |
|
||||
| ellipsis | Whether to ellipsis too long title | *boolean* | `true` |
|
||||
| sticky | Whether to use sticky mode | *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` |
|
||||
| scrollspy `v2.3.0` | Whether to use scrollspy mode | *boolean* | `false` |
|
||||
| offset-top | Offset top when use sticky mode | *number \| string* | `0` |
|
||||
| swipe-threshold | Set swipe tabs threshold | *number \| string* | `4` | - |
|
||||
| title-active-color | Title active color | *string* | - |
|
||||
| title-inactive-color | Title inactive color | *string* | - |
|
||||
| --- | --- | --- | --- |
|
||||
| v-model | Index of active tab | _number \| string_ | `0` |
|
||||
| type | Can be set to `line` `card` | _string_ | `line` |
|
||||
| color | Tab color | _string_ | `#ee0a24` |
|
||||
| background | Background color | _string_ | `white` |
|
||||
| duration | Toggle tab's animation time | _number \| string_ | `0.3` | - |
|
||||
| line-width | Width of tab line | _number \| string_ | Width of active tab |
|
||||
| line-height | Height of tab line | _number \| string_ | `3px` |
|
||||
| animated | Whether to change tabs with animation | _boolean_ | `false` |
|
||||
| border | Whether to show border when `type="line"` | _boolean_ | `true` |
|
||||
| ellipsis | Whether to ellipsis too long title | _boolean_ | `true` |
|
||||
| sticky | Whether to use sticky mode | _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` |
|
||||
| scrollspy `v2.3.0` | Whether to use scrollspy mode | _boolean_ | `false` |
|
||||
| offset-top | Offset top when use sticky mode | _number \| string_ | `0` |
|
||||
| swipe-threshold | Set swipe tabs threshold | _number \| string_ | `4` | - |
|
||||
| title-active-color | Title active color | _string_ | - |
|
||||
| title-inactive-color | Title inactive color | _string_ | - |
|
||||
|
||||
### Tab Props
|
||||
|
||||
| Attribute | Description | Type | Default |
|
||||
|------|------|------|------|
|
||||
| title | Title | *string* | - |
|
||||
| disabled | Whether to disable tab | *boolean* | `false` |
|
||||
| dot `v2.3.0` | Whether to show red dot on the title | *boolean* | `false` |
|
||||
| badge `v2.5.6` | Content of the badge on the title | *number \| string* | - |
|
||||
| name `v2.0.6` | Identifier | *number \| string* | Index of tab |
|
||||
| url `v2.2.1` | Link | *string* | - |
|
||||
| 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` |
|
||||
| title-style `v2.2.14` | Custom title style | *any* | - |
|
||||
| --- | --- | --- | --- |
|
||||
| title | Title | _string_ | - |
|
||||
| disabled | Whether to disable tab | _boolean_ | `false` |
|
||||
| dot `v2.3.0` | Whether to show red dot on the title | _boolean_ | `false` |
|
||||
| badge `v2.5.6` | Content of the badge on the title | _number \| string_ | - |
|
||||
| name `v2.0.6` | Identifier | _number \| string_ | Index of tab |
|
||||
| url `v2.2.1` | Link | _string_ | - |
|
||||
| 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` |
|
||||
| title-style `v2.2.14` | Custom title style | _any_ | - |
|
||||
|
||||
### Tabs Events
|
||||
|
||||
| Event | Description | Arguments |
|
||||
|------|------|------|
|
||||
| --- | --- | --- |
|
||||
| click | Triggered when click tab | name,title |
|
||||
| change | Triggered when active tab changed | name,title |
|
||||
| disabled | Triggered when click disabled tab | name,title |
|
||||
@@ -241,19 +239,19 @@ In scrollspy mode, the list of content will be tiled
|
||||
Use [ref](https://vuejs.org/v2/api/#ref) to get Tabs instance and call instance methods
|
||||
|
||||
| Name | Description | Attribute | Return value |
|
||||
|------|------|------|------|
|
||||
| --- | --- | --- | --- |
|
||||
| resize | Resize Tabs when container element resized | - | void |
|
||||
|
||||
### Tabs Slots
|
||||
|
||||
| Name | Description |
|
||||
|------|------|
|
||||
| nav-left | Custom nav left content |
|
||||
| Name | Description |
|
||||
| --------- | ------------------------ |
|
||||
| nav-left | Custom nav left content |
|
||||
| nav-right | Custom nav right content |
|
||||
|
||||
### Tab Slots
|
||||
|
||||
| Name | Description |
|
||||
|------|------|
|
||||
| default | Content of tab |
|
||||
| title | Custom tab title |
|
||||
| Name | Description |
|
||||
| ------- | ---------------- |
|
||||
| default | Content of tab |
|
||||
| title | Custom tab title |
|
||||
|
||||
+52
-54
@@ -29,10 +29,10 @@ Vue.use(Tabs);
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 2
|
||||
active: 2,
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 通过名称匹配
|
||||
@@ -51,10 +51,10 @@ export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
activeName: 'a'
|
||||
activeName: 'a',
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
### 标签栏滚动
|
||||
@@ -88,8 +88,8 @@ export default {
|
||||
methods: {
|
||||
onClickDisabled(name, title) {
|
||||
Toast(name + '已被禁用');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@@ -123,8 +123,8 @@ export default {
|
||||
methods: {
|
||||
onClick(name, title) {
|
||||
Toast(title);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@@ -147,9 +147,7 @@ export default {
|
||||
```html
|
||||
<van-tabs v-model="active">
|
||||
<van-tab v-for="index in 2" :key="index">
|
||||
<template #title>
|
||||
<van-icon name="more-o" />选项
|
||||
</template>
|
||||
<template #title> <van-icon name="more-o" />选项 </template>
|
||||
内容 {{ index }}
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
@@ -196,45 +194,45 @@ export default {
|
||||
### Tabs Props
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------|------|------|------|
|
||||
| v-model | 绑定当前选中标签的标识符 | *number \| string* | `0` |
|
||||
| type | 样式风格类型,可选值为`card` | *string* | `line` |
|
||||
| color | 标签主题色 | *string* | `#ee0a24` |
|
||||
| background | 标签栏背景色 | *string* | `white` |
|
||||
| duration | 动画时间,单位秒 | *number \| string* | `0.3` |
|
||||
| line-width | 底部条宽度,默认单位`px` | *number \| string* | `auto` |
|
||||
| line-height | 底部条高度,默认单位`px` | *number \| string* | `3px` |
|
||||
| animated | 是否开启切换标签内容时的转场动画 | *boolean* | `false` |
|
||||
| border | 是否显示标签栏外边框,仅在`type="line"`时有效 | *boolean* | `true` |
|
||||
| ellipsis | 是否省略过长的标题文字 | *boolean* | `true` |
|
||||
| sticky | 是否使用粘性定位布局 | *boolean* | `false` |
|
||||
| swipeable | 是否开启手势滑动切换 | *boolean* | `false` |
|
||||
| lazy-render | 是否开启延迟渲染(首次切换到标签时才触发内容渲染) | *boolean* | `true` |
|
||||
| scrollspy `v2.3.0` | 是否开启滚动导航 | *boolean* | `false` |
|
||||
| offset-top | 粘性定位布局下与顶部的最小距离,单位`px` | *number \| string* | `0` |
|
||||
| swipe-threshold | 滚动阈值,标签数量超过阈值时开始横向滚动 | *number \| string* | `4` |
|
||||
| title-active-color | 标题选中态颜色 | *string* | - |
|
||||
| title-inactive-color | 标题默认态颜色 | *string* | - |
|
||||
| --- | --- | --- | --- |
|
||||
| v-model | 绑定当前选中标签的标识符 | _number \| string_ | `0` |
|
||||
| type | 样式风格类型,可选值为`card` | _string_ | `line` |
|
||||
| color | 标签主题色 | _string_ | `#ee0a24` |
|
||||
| background | 标签栏背景色 | _string_ | `white` |
|
||||
| duration | 动画时间,单位秒 | _number \| string_ | `0.3` |
|
||||
| line-width | 底部条宽度,默认单位`px` | _number \| string_ | `auto` |
|
||||
| line-height | 底部条高度,默认单位`px` | _number \| string_ | `3px` |
|
||||
| animated | 是否开启切换标签内容时的转场动画 | _boolean_ | `false` |
|
||||
| border | 是否显示标签栏外边框,仅在`type="line"`时有效 | _boolean_ | `true` |
|
||||
| ellipsis | 是否省略过长的标题文字 | _boolean_ | `true` |
|
||||
| sticky | 是否使用粘性定位布局 | _boolean_ | `false` |
|
||||
| swipeable | 是否开启手势滑动切换 | _boolean_ | `false` |
|
||||
| lazy-render | 是否开启延迟渲染(首次切换到标签时才触发内容渲染) | _boolean_ | `true` |
|
||||
| scrollspy `v2.3.0` | 是否开启滚动导航 | _boolean_ | `false` |
|
||||
| offset-top | 粘性定位布局下与顶部的最小距离,单位`px` | _number \| string_ | `0` |
|
||||
| swipe-threshold | 滚动阈值,标签数量超过阈值时开始横向滚动 | _number \| string_ | `4` |
|
||||
| title-active-color | 标题选中态颜色 | _string_ | - |
|
||||
| title-inactive-color | 标题默认态颜色 | _string_ | - |
|
||||
|
||||
### Tab Props
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
|------|------|------|------|
|
||||
| title | 标题 | *string* | - |
|
||||
| disabled | 是否禁用标签 | *boolean* | `false` |
|
||||
| dot `v2.3.0` | 是否在标题右上角显示小红点 | *boolean* | `false` |
|
||||
| badge `v2.5.6` | 图标右上角徽标的内容 | *number \| string* | - |
|
||||
| info `v2.3.0` | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | *number \| string* | - |
|
||||
| name `v2.0.6` | 标签名称,作为匹配的标识符 | *number \| string* | 标签的索引值 |
|
||||
| url `v2.2.1` | 点击后跳转的链接地址 | *string* | - |
|
||||
| to `v2.2.1` | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | *string \| object* | - |
|
||||
| replace `v2.2.1` | 是否在跳转时替换当前页面历史 | *boolean* | `false` |
|
||||
| title-style `v2.2.14` | 自定义标题样式 | *any* | - |
|
||||
| --- | --- | --- | --- |
|
||||
| title | 标题 | _string_ | - |
|
||||
| disabled | 是否禁用标签 | _boolean_ | `false` |
|
||||
| dot `v2.3.0` | 是否在标题右上角显示小红点 | _boolean_ | `false` |
|
||||
| badge `v2.5.6` | 图标右上角徽标的内容 | _number \| string_ | - |
|
||||
| info `v2.3.0` | 图标右上角徽标的内容(已废弃,请使用 badge 属性) | _number \| string_ | - |
|
||||
| name `v2.0.6` | 标签名称,作为匹配的标识符 | _number \| string_ | 标签的索引值 |
|
||||
| url `v2.2.1` | 点击后跳转的链接地址 | _string_ | - |
|
||||
| to `v2.2.1` | 点击后跳转的目标路由对象,同 vue-router 的 [to 属性](https://router.vuejs.org/zh/api/#to) | _string \| object_ | - |
|
||||
| replace `v2.2.1` | 是否在跳转时替换当前页面历史 | _boolean_ | `false` |
|
||||
| title-style `v2.2.14` | 自定义标题样式 | _any_ | - |
|
||||
|
||||
### Tabs Events
|
||||
|
||||
| 事件名 | 说明 | 回调参数 |
|
||||
|------|------|------|
|
||||
| --- | --- | --- |
|
||||
| click | 点击标签时触发 | name:标识符,title:标题 |
|
||||
| change | 当前激活的标签改变时触发 | name:标识符,title:标题 |
|
||||
| disabled | 点击被禁用的标签时触发 | name:标识符,title:标题 |
|
||||
@@ -245,20 +243,20 @@ export default {
|
||||
|
||||
通过 ref 可以获取到 Tabs 实例并调用实例方法,详见[组件实例方法](#/zh-CN/quickstart#zu-jian-shi-li-fang-fa)
|
||||
|
||||
| 方法名 | 说明 | 参数 | 返回值 |
|
||||
|------|------|------|------|
|
||||
| resize | 外层元素大小变化后,可以调用此方法来触发重绘 | - | void |
|
||||
| 方法名 | 说明 | 参数 | 返回值 |
|
||||
| ------ | -------------------------------------------- | ---- | ------ |
|
||||
| resize | 外层元素大小变化后,可以调用此方法来触发重绘 | - | void |
|
||||
|
||||
### Tabs Slots
|
||||
|
||||
| 名称 | 说明 |
|
||||
|------|------|
|
||||
| nav-left | 标题左侧内容 |
|
||||
| 名称 | 说明 |
|
||||
| --------- | ------------ |
|
||||
| nav-left | 标题左侧内容 |
|
||||
| nav-right | 标题右侧内容 |
|
||||
|
||||
### Tab Slots
|
||||
|
||||
| 名称 | 说明 |
|
||||
|------|------|
|
||||
| default | 标签页内容 |
|
||||
| title | 自定义标题,不支持动态渲染 |
|
||||
| 名称 | 说明 |
|
||||
| ------- | -------------------------- |
|
||||
| default | 标签页内容 |
|
||||
| title | 自定义标题,不支持动态渲染 |
|
||||
|
||||
Reference in New Issue
Block a user