diff --git a/src/step/index.js b/src/step/index.js index 98bda55d3..cbd066464 100644 --- a/src/step/index.js +++ b/src/step/index.js @@ -17,16 +17,23 @@ export default createComponent({ return 'process'; } }, + active() { + return this.status === 'process'; + }, }, methods: { genCircle() { const { activeIcon, activeColor, inactiveIcon } = this.parent; - if (this.status === 'process') { + if (this.active) { return ( this.slots('active-icon') || ( - + ) ); } @@ -44,13 +51,13 @@ export default createComponent({ }, render() { - const { status } = this; + const { status, active } = this; const { activeColor, direction } = this.parent; - const titleStyle = status === 'process' && { color: activeColor }; + const titleStyle = active && { color: activeColor }; return (
-
+
{this.slots()}
{this.genCircle()}
diff --git a/src/step/index.less b/src/step/index.less index 94fcb1986..d4a7dcb95 100644 --- a/src/step/index.less +++ b/src/step/index.less @@ -138,4 +138,11 @@ background-color: @step-finish-line-color; } } + + &__icon, + &__title { + &--active { + color: @step-active-color; + } + } } diff --git a/src/steps/index.js b/src/steps/index.js index 3f72394c6..48352c91b 100644 --- a/src/steps/index.js +++ b/src/steps/index.js @@ -1,5 +1,4 @@ import { createNamespace } from '../utils'; -import { GREEN } from '../utils/constant'; import { ParentMixin } from '../mixins/relation'; const [createComponent, bem] = createNamespace('steps'); @@ -8,6 +7,7 @@ export default createComponent({ mixins: [ParentMixin('vanSteps')], props: { + activeColor: String, inactiveIcon: String, active: { type: Number, @@ -17,10 +17,6 @@ export default createComponent({ type: String, default: 'horizontal', }, - activeColor: { - type: String, - default: GREEN, - }, activeIcon: { type: String, default: 'checked', diff --git a/src/steps/test/__snapshots__/demo.spec.js.snap b/src/steps/test/__snapshots__/demo.spec.js.snap index 2aaf48fbd..8c36d07f5 100644 --- a/src/steps/test/__snapshots__/demo.spec.js.snap +++ b/src/steps/test/__snapshots__/demo.spec.js.snap @@ -11,8 +11,8 @@ exports[`renders demo correctly 1`] = `
-
商家接单
-
+
商家接单
+
@@ -39,8 +39,8 @@ exports[`renders demo correctly 1`] = `
-
商家接单
-
+
商家接单
+
@@ -63,11 +63,11 @@ exports[`renders demo correctly 1`] = `
-
+

【城市】物流状态1

2016-07-12 12:40

-
+
diff --git a/src/steps/test/__snapshots__/index.spec.js.snap b/src/steps/test/__snapshots__/index.spec.js.snap index 3041df61f..232fc1a04 100644 --- a/src/steps/test/__snapshots__/index.spec.js.snap +++ b/src/steps/test/__snapshots__/index.spec.js.snap @@ -11,7 +11,7 @@ exports[`icon slot 1`] = `
-
+
B
Custim Active Icon
diff --git a/src/style/var.less b/src/style/var.less index 2d9cc90c1..65b3652fc 100644 --- a/src/style/var.less +++ b/src/style/var.less @@ -611,6 +611,7 @@ // Step @step-text-color: @gray-6; +@step-active-color: @green; @step-process-text-color: @text-color; @step-font-size: @font-size-md; @step-line-color: @border-color;