diff --git a/docs/markdown/v2-progress-tracking.md b/docs/markdown/v2-progress-tracking.md index 6a369c1de..e65375a1e 100644 --- a/docs/markdown/v2-progress-tracking.md +++ b/docs/markdown/v2-progress-tracking.md @@ -75,6 +75,7 @@ ### Steps - 新增`inactive-icon`属性 +- 新增`inactive-icon`插槽 ### SwitchCell diff --git a/packages/step/index.js b/packages/step/index.js index 68bc5aaa4..c0c0fe551 100644 --- a/packages/step/index.js +++ b/packages/step/index.js @@ -43,8 +43,9 @@ export default sfc({ ); } - if (inactiveIcon) { - return ; + const inactiveIconSlot = slots('inactive-icon'); + if (inactiveIcon || inactiveIconSlot) { + return inactiveIconSlot || ; } return ; diff --git a/packages/steps/en-US.md b/packages/steps/en-US.md index 163e0ba7f..e0d0caa6e 100644 --- a/packages/steps/en-US.md +++ b/packages/steps/en-US.md @@ -79,4 +79,5 @@ export default { | Name | Description | |------|------| -| icon | Custom icon | +| active-icon | Custom active icon | +| inactive-icon | Custom inactive icon | diff --git a/packages/steps/test/__snapshots__/index.spec.js.snap b/packages/steps/test/__snapshots__/index.spec.js.snap new file mode 100644 index 000000000..3041df61f --- /dev/null +++ b/packages/steps/test/__snapshots__/index.spec.js.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`icon slot 1`] = ` +
+
+
+
+ A +
+
Custim Inactive Icon
+
+
+
+
+ B +
+
Custim Active Icon
+
+
+
+
+ C +
+
Custim Inactive Icon
+
+
+
+
+`; diff --git a/packages/steps/test/index.spec.js b/packages/steps/test/index.spec.js new file mode 100644 index 000000000..748a6ed56 --- /dev/null +++ b/packages/steps/test/index.spec.js @@ -0,0 +1,29 @@ +import { mount } from '../../../test/utils'; +import Steps from '..'; +import Step from '../../step'; + +test('icon slot', () => { + const wrapper = mount({ + template: ` + + + + A + + + + B + + + + C + + + `, + components: { + Steps, + Step + } + }); + expect(wrapper).toMatchSnapshot(); +}); diff --git a/packages/steps/zh-CN.md b/packages/steps/zh-CN.md index 833e8a881..993453565 100644 --- a/packages/steps/zh-CN.md +++ b/packages/steps/zh-CN.md @@ -83,3 +83,4 @@ export default { | 名称 | 说明 | |------|------| | active-icon | 自定义激活状态图标 | +| inactive-icon | 自定义未激活状态图标 |