From 2c47a3443b8cd4ccea0eaa1363578c92c0525362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=95=8F?= Date: Tue, 4 Jul 2017 19:06:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E6=9D=A1=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=96=B0=E5=A2=9Edirection=E5=92=8CactiveColor=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=AB=96=E7=9A=84?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E6=9D=A1=20(#49)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/examples-docs/steps.md | 25 ++++ packages/steps/src/step.vue | 21 +++- packages/steps/src/steps.vue | 22 +++- packages/vant-css/src/steps.css | 214 +++++++++++++++++++++----------- test/unit/specs/steps.spec.js | 13 ++ 5 files changed, 213 insertions(+), 82 deletions(-) diff --git a/docs/examples-docs/steps.md b/docs/examples-docs/steps.md index eebe46708..6fa81f664 100644 --- a/docs/examples-docs/steps.md +++ b/docs/examples-docs/steps.md @@ -111,6 +111,29 @@ export default { ``` ::: +#### 竖式步骤条 + +可以通过设置`direction`属性来改变步骤条的显示方式,可选值有`vertical/horizontal`。 + +:::demo 只显示步骤条 +```html + + +

【城市】最新的物流状态之类的表述哈哈哈哈

+

2016-07-12 12:12:12

+
+ +

【城市】已经过了的物流状态我是折行我是折行我是折行联系电话:158630099999

+

2016-07-12 12:12:12

+
+ +

未发货

+

2016-07-12 12:12:12

+
+
+``` +::: + ### 高级用法 可以使用具名`slot`增加自定义内容,其中包含`icon`和`message-extra`。 @@ -137,6 +160,8 @@ export default { | iconClass | 当前步骤栏为icon添加的类 | `string` | | | | title | 当前步骤从标题 | `string` | | | | description | 当前步骤描述 | `string` | | | +| direction | 显示方向 | `string` | `horizontal` | `vertical/horizontal` | +| activeColor | `active`状态时的颜色 | `string` | `#06bf04` | | ### Steps Slot diff --git a/packages/steps/src/step.vue b/packages/steps/src/step.vue index 5dd205e3d..39c800014 100644 --- a/packages/steps/src/step.vue +++ b/packages/steps/src/step.vue @@ -1,12 +1,12 @@ @@ -30,9 +30,18 @@ export default { return 'process'; } }, - statusClass() { + stepClass() { const status = this.status; - return status ? 'van-step--' + status : ''; + const statusClass = status ? 'van-step--' + status : ''; + const directionClass = `van-step--${this.$parent.direction}`; + return [directionClass, statusClass]; + }, + titleStyle() { + if (this.status === 'process') { + return { + color: this.$parent.activeColor + }; + } } } }; diff --git a/packages/steps/src/steps.vue b/packages/steps/src/steps.vue index 2fd212148..bfca083fa 100644 --- a/packages/steps/src/steps.vue +++ b/packages/steps/src/steps.vue @@ -1,5 +1,5 @@