From 0738f3baac4e580c0b06107cf98bab9ef61f83b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 30 Jan 2020 10:21:41 +0800 Subject: [PATCH] feat(Steps): active can be string --- src/step/index.js | 2 +- src/steps/README.md | 3 +-- src/steps/README.zh-CN.md | 4 +++- src/steps/index.js | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/step/index.js b/src/step/index.js index c5fb1c2b2..ce84b9e29 100644 --- a/src/step/index.js +++ b/src/step/index.js @@ -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'; } }, diff --git a/src/steps/README.md b/src/steps/README.md index 51d7d4230..7b4359b63 100644 --- a/src/steps/README.md +++ b/src/steps/README.md @@ -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` | diff --git a/src/steps/README.zh-CN.md b/src/steps/README.zh-CN.md index 3b7694b2f..81a195687 100644 --- a/src/steps/README.zh-CN.md +++ b/src/steps/README.zh-CN.md @@ -14,6 +14,8 @@ Vue.use(Steps); ### 基础用法 +`active`属性表示当前步骤的索引,从 0 起计 + ```html 买家下单 @@ -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` | diff --git a/src/steps/index.js b/src/steps/index.js index 48352c91b..531c5281a 100644 --- a/src/steps/index.js +++ b/src/steps/index.js @@ -10,7 +10,7 @@ export default createComponent({ activeColor: String, inactiveIcon: String, active: { - type: Number, + type: [Number, String], default: 0, }, direction: {