-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
东杰
committed
May 14, 2019
1 parent
91b9aac
commit be2a33a
Showing
15 changed files
with
337 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Component({ | ||
properties: { | ||
steps: { | ||
type: Array, | ||
value: [] | ||
}, | ||
active: { | ||
type: Number, | ||
value: 3 | ||
}, | ||
activeColor: { | ||
type: String, | ||
value: '#36CFC9' | ||
}, | ||
icon: { | ||
type: String, | ||
value: 'circle-fill' | ||
}, | ||
activeIcon: { | ||
type: String, | ||
value: 'circle-fill' | ||
}, | ||
vertical: { | ||
type: Boolean, | ||
value: false | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"component": true, | ||
"usingComponents": { | ||
"d-icon": "../icon/index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<view class="d-steps"> | ||
<view | ||
wx:for="{{steps}}" | ||
wx:if="{{ !vertical }}" | ||
wx:key="unique" | ||
wx:for-index="index" | ||
class="d-steps-item {{ index === (steps.length -1) ? 'd-steps-item-last' : '' }}" | ||
> | ||
<view | ||
class="d-steps-txt {{index === 0 ? 'd-steps-txt-first' : (index === (steps.length -1) ? 'd-steps-txt-last' : '')}}" | ||
style="color: {{(index + 1) <= active ? activeColor : ''}}" | ||
> | ||
<view class="d-steps-title">{{ item.title }}</view> | ||
<view class="d-steps-des">{{ item.des }}</view> | ||
</view> | ||
|
||
<view class="d-steps-line-box"> | ||
<view | ||
class="d-steps-line" | ||
style="background: {{(index + 1) < active ? activeColor : ''}}" | ||
></view> | ||
<view | ||
class="d-steps-icon {{index === 0 ? 'd-steps-icon-first' : (index === (steps.length -1) ? 'd-steps-icon-last' : '')}}" | ||
> | ||
<d-icon | ||
name="{{ (index + 1) <= active ? activeIcon : icon }}" | ||
color="{{(index + 1) <= active ? activeColor : '#eee'}}" | ||
></d-icon> | ||
</view> | ||
</view> | ||
</view> | ||
</view> | ||
|
||
<view class="d-steps-vertical"> | ||
<view | ||
wx:for="{{steps}}" | ||
wx:if="{{ vertical }}" | ||
wx:key="unique" | ||
wx:for-index="index" | ||
class="d-steps-vertical-item" | ||
> | ||
<view class="d-steps-vertical-line-box"> | ||
<view | ||
class="d-steps-vertical-line {{index === (steps.length -1) ? 'd-steps-vertical-line-last' : ''}}" | ||
style="background: {{(index + 1) < active ? activeColor : ''}}" | ||
></view> | ||
<view | ||
class="d-steps-vertical-icon" | ||
> | ||
<d-icon | ||
name="{{ (index + 1) <= active ? activeIcon : icon }}" | ||
color="{{(index + 1) <= active ? activeColor : '#eee'}}" | ||
></d-icon> | ||
</view> | ||
</view> | ||
<view | ||
class="d-steps-vertical-txt" | ||
style="color: {{(index + 1) <= active ? activeColor : ''}}" | ||
> | ||
<view class="d-steps-title">{{ item.title }}</view> | ||
<view class="d-steps-des">{{ item.des }}</view> | ||
</view> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.d-steps{position:relative;display:flex;overflow:hidden}.d-steps-item{position:relative;display:flex;flex:1}.d-steps-item-last{position:absolute;right:0}.d-steps-item .d-steps-txt{color:#999;font-size:10px;display:inline-block;padding-bottom:20px;transform:translate3d(-50%,0,0)}.d-steps-item .d-steps-txt-first,.d-steps-item .d-steps-txt-last{transform:translate3d(0,0,0)}.d-steps-line-box .d-steps-line{position:absolute;bottom:8px;left:14%;right:0;height:1px;background:#eee;width:70%}.d-steps-line-box .d-steps-icon{position:absolute;bottom:10px;left:0;text-align:center;transform:translate3d(-50%,50%,0)}.d-steps-line-box .d-steps-icon-first{transform:translate3d(0,50%,0)}.d-steps-line-box .d-steps-icon-last{right:0;padding:0;text-align:right;transform:translate3d(0,50%,0)}.d-steps-vertical{position:relative}.d-steps-vertical-item{position:relative;display:flex;flex:1;padding:10px 0}.d-steps-vertical-item .d-steps-vertical-txt{color:#999;font-size:10px;display:inline-block;padding-left:8px}.d-steps-vertical-line-box .d-steps-vertical-line{position:absolute;top:26px;bottom:0;width:1px;background:#eee;height:100%;left:5px}.d-steps-vertical-line-box .d-steps-vertical-line-last{display:none} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"usingComponents": {} | ||
"navigationBarTitleText": "Steps 步骤条", | ||
"usingComponents": { | ||
"d-steps": "../../dist/steps/index" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
<!--pages/steps/index.wxml--> | ||
<text>pages/steps/index.wxml</text> | ||
|
||
<view class="demo-box"> | ||
<view class="demo-title">普通steps</view> | ||
<view class="demo-content"> | ||
<d-steps steps="{{ steps1 }}"></d-steps> | ||
</view> | ||
<view class="demo-title">竖向steps</view> | ||
<view class="demo-content"> | ||
<d-steps vertical steps="{{ steps2 }}"></d-steps> | ||
</view> | ||
</view> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,15 @@ | ||
/* pages/steps/index.wxss */ | ||
.demo-box{ | ||
background: #f8f8f8; | ||
margin-bottom: 20rpx; | ||
} | ||
.demo-title{ | ||
font-size: 32rpx; | ||
color: #333; | ||
padding-bottom: 30rpx; | ||
padding-left: 30rpx; | ||
padding-top: 30rpx; | ||
} | ||
.demo-content{ | ||
background: #fff; | ||
padding: 10px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.