feat(Steps): add finish-icon prop (#8237)

This commit is contained in:
neverland 2021-02-28 19:26:55 +08:00 committed by GitHub
parent 8078e30cbc
commit 42d8dd4256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 2 deletions

View File

@ -41,7 +41,7 @@ export default createComponent({
methods: { methods: {
genCircle() { genCircle() {
const { activeIcon, activeColor, inactiveIcon } = this.parent; const { activeIcon, activeColor, finishIcon, inactiveIcon } = this.parent;
if (this.active) { if (this.active) {
return ( return (
@ -55,6 +55,16 @@ export default createComponent({
); );
} }
if (this.status === 'finish' && finishIcon) {
return (
<Icon
class={bem('icon', 'finish')}
name={finishIcon}
color={activeColor}
/>
);
}
const inactiveIconSlot = this.slots('inactive-icon'); const inactiveIconSlot = this.slots('inactive-icon');
if (inactiveIcon || inactiveIconSlot) { if (inactiveIcon || inactiveIconSlot) {

View File

@ -144,7 +144,8 @@
&__title { &__title {
transition: color @animation-duration-base; transition: color @animation-duration-base;
&--active { &--active,
&--finish {
color: @step-active-color; color: @step-active-color;
} }
} }

View File

@ -75,6 +75,7 @@ export default {
| inactive-color `v2.9.1` | Inactive step color | _string_ | `#969799` | | inactive-color `v2.9.1` | Inactive step color | _string_ | `#969799` |
| active-icon | Active icon name | _string_ | `checked` | | active-icon | Active icon name | _string_ | `checked` |
| inactive-icon | Inactive icon name | _string_ | - | | inactive-icon | Inactive icon name | _string_ | - |
| finish-icon `v2.12.7` | Finish icon name | _string_ | - |
### Step Slots ### Step Slots

View File

@ -85,6 +85,7 @@ export default {
| inactive-color `v2.9.1` | 未激活状态颜色 | _string_ | `#969799` | | inactive-color `v2.9.1` | 未激活状态颜色 | _string_ | `#969799` |
| active-icon | 激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | `checked` | | active-icon | 激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | `checked` |
| inactive-icon | 未激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | - | | inactive-icon | 未激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | - |
| finish-icon `v2.12.7` | 已完成步骤对应的底部图标,优先级高于 `inactive-icon`,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | - |
### Step Slots ### Step Slots

View File

@ -7,6 +7,7 @@ export default createComponent({
mixins: [ParentMixin('vanSteps')], mixins: [ParentMixin('vanSteps')],
props: { props: {
finishIcon: String,
activeColor: String, activeColor: String,
inactiveIcon: String, inactiveIcon: String,
inactiveColor: String, inactiveColor: String,