diff --git a/examples/docs/en-US/steps.md b/examples/docs/en-US/steps.md index 2f30dfe0e..dfd494533 100644 --- a/examples/docs/en-US/steps.md +++ b/examples/docs/en-US/steps.md @@ -114,7 +114,7 @@ Vertical step bars. | Attribute | Description | Type | Accepted Values | Default | |---------- |-------- |---------- |------------- |-------- | -| space | the spacing of each step, will be responsive if omitted | Number | — | — | +| space | the spacing of each step, will be responsive if omitted. Support percentage. | Number,String | — | — | | direction | display direction | string | vertical/horizontal | horizontal | | active | current activation step | number | — | 0 | | process-status | status of current step | string | wait/process/finish/error/success | process | diff --git a/examples/docs/zh-CN/steps.md b/examples/docs/zh-CN/steps.md index 95a181c90..5eac5beb2 100644 --- a/examples/docs/zh-CN/steps.md +++ b/examples/docs/zh-CN/steps.md @@ -108,7 +108,7 @@ | 参数 | 说明 | 类型 | 可选值 | 默认值 | |---------- |-------- |---------- |------------- |-------- | -| space | 每个 step 的间距,不填写将自适应间距 | Number | — | — | +| space | 每个 step 的间距,不填写将自适应间距。支持百分比。 | Number,String | — | — | | direction | 显示方向 | string | vertical/horizontal | horizontal | | active | 设置当前激活步骤 | number | — | 0 | | process-status | 设置当前步骤的状态 | string | wait/process/finish/error/success | process | diff --git a/packages/steps/src/step.vue b/packages/steps/src/step.vue index be8d7631a..b0faeb7d2 100644 --- a/packages/steps/src/step.vue +++ b/packages/steps/src/step.vue @@ -118,9 +118,11 @@ export default { const isCenter = parent.center; const len = parent.steps.length; const isLast = this.isLast = parent.steps[parent.steps.length - 1] === this; - const space = parent.space + const space = typeof parent.space === 'number' ? parent.space + 'px' - : 100 / (isCenter ? len - 1 : len) + '%'; + : parent.space + ? parent.space + : 100 / (isCenter ? len - 1 : len) + '%'; if (parent.direction === 'horizontal') { this.style = { width: space }; diff --git a/packages/steps/src/steps.vue b/packages/steps/src/steps.vue index ff2569d73..4b99cf262 100644 --- a/packages/steps/src/steps.vue +++ b/packages/steps/src/steps.vue @@ -11,7 +11,7 @@ export default { name: 'ElSteps', props: { - space: Number, + space: [Number, String], active: Number, direction: { type: String,