feat(Steps): active can be string

This commit is contained in:
陈嘉涵 2020-01-30 10:21:41 +08:00
parent b24fd2bb48
commit 0738f3baac
4 changed files with 6 additions and 5 deletions

View File

@ -13,7 +13,7 @@ export default createComponent({
if (this.index < this.parent.active) {
return 'finish';
}
if (this.index === this.parent.active) {
if (this.index === +this.parent.active) {
return 'process';
}
},

View File

@ -73,8 +73,7 @@ export default {
| Attribute | Description | Type | Default |
|------|------|------|------|
| active | Active step | *number* | 0 |
| description | Description | *string* | - |
| active | Active step | *number \| string* | `0` |
| direction | Can be set to `vertical` | *string* | `horizontal` |
| active-color | Active step color | *string* | `#07c160` |
| active-icon | Active icon name | *string* | `checked` |

View File

@ -14,6 +14,8 @@ Vue.use(Steps);
### 基础用法
`active`属性表示当前步骤的索引,从 0 起计
```html
<van-steps :active="active">
<van-step>买家下单</van-step>
@ -77,7 +79,7 @@ export default {
| 参数 | 说明 | 类型 | 默认值 |
|------|------|------|------|
| active | 当前步骤 | *number* | 0 |
| active | 当前步骤 | *number \| string* | `0` |
| direction | 显示方向,可选值为 `vertical` | *string* | `horizontal` |
| active-color | 激活状态颜色 | *string* | `#07c160` |
| active-icon | 激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | *string* | `checked` |

View File

@ -10,7 +10,7 @@ export default createComponent({
activeColor: String,
inactiveIcon: String,
active: {
type: Number,
type: [Number, String],
default: 0,
},
direction: {