feat(Steps): add icon-prefix prop (#8630)

This commit is contained in:
neverland 2021-04-28 16:58:07 +08:00 committed by GitHub
parent 1779946edb
commit f470f0f854
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 2 deletions

View File

@ -41,7 +41,13 @@ export default createComponent({
methods: {
genCircle() {
const { activeIcon, activeColor, finishIcon, inactiveIcon } = this.parent;
const {
activeIcon,
iconPrefix,
activeColor,
finishIcon,
inactiveIcon,
} = this.parent;
if (this.active) {
return (
@ -50,6 +56,7 @@ export default createComponent({
class={bem('icon', 'active')}
name={activeIcon}
color={activeColor}
classPrefix={iconPrefix}
/>
)
);
@ -63,6 +70,7 @@ export default createComponent({
class={bem('icon', 'finish')}
name={finishIcon}
color={activeColor}
classPrefix={iconPrefix}
/>
)
);
@ -72,7 +80,13 @@ export default createComponent({
if (inactiveIcon || inactiveIconSlot) {
return (
inactiveIconSlot || <Icon class={bem('icon')} name={inactiveIcon} />
inactiveIconSlot || (
<Icon
class={bem('icon')}
name={inactiveIcon}
classPrefix={iconPrefix}
/>
)
);
}

View File

@ -76,6 +76,7 @@ export default {
| active-icon | Active icon name | _string_ | `checked` |
| inactive-icon | Inactive icon name | _string_ | - |
| finish-icon `v2.12.7` | Finish icon name | _string_ | - |
| icon-prefix `v2.12.15` | Icon className prefix | _string_ | `van-icon` |
### Step Slots

View File

@ -86,6 +86,7 @@ export default {
| active-icon | 激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | `checked` |
| inactive-icon | 未激活状态底部图标,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | - |
| finish-icon `v2.12.7` | 已完成步骤对应的底部图标,优先级高于 `inactive-icon`,可选值见 [Icon 组件](#/zh-CN/icon) | _string_ | - |
| icon-prefix `v2.12.15` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
### Step Slots

View File

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