mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-08-07 22:01:15 +08:00
parent
83dc420112
commit
29775b20b8
@ -70,10 +70,3 @@ Page({
|
|||||||
| 类名 | 说明 |
|
| 类名 | 说明 |
|
||||||
|-----------|-----------|
|
|-----------|-----------|
|
||||||
| custom-class | 根节点样式类 |
|
| custom-class | 根节点样式类 |
|
||||||
|
|
||||||
### 更新日志
|
|
||||||
|
|
||||||
| 版本 | 类型 | 内容 |
|
|
||||||
|-----------|-----------|-----------|
|
|
||||||
| 0.0.1 | feature | 新增组件 |
|
|
||||||
| 0.3.4 | bugfix | 修复样式错误的问题 |
|
|
||||||
|
@ -36,8 +36,8 @@
|
|||||||
&__circle {
|
&__circle {
|
||||||
width: 5px;
|
width: 5px;
|
||||||
height: 5px;
|
height: 5px;
|
||||||
border-radius: 50%;
|
|
||||||
background-color: @gray-dark;
|
background-color: @gray-dark;
|
||||||
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--horizontal {
|
&--horizontal {
|
||||||
@ -60,8 +60,8 @@
|
|||||||
width: auto;
|
width: auto;
|
||||||
|
|
||||||
.van-step__title {
|
.van-step__title {
|
||||||
transform: none;
|
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.van-step__circle-container {
|
.van-step__circle-container {
|
||||||
@ -88,9 +88,9 @@
|
|||||||
|
|
||||||
.van-step__line {
|
.van-step__line {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 6px;
|
bottom: 6px;
|
||||||
|
left: 0;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background-color: @border-color;
|
background-color: @border-color;
|
||||||
transform: translate3d(0, 50%, 0);
|
transform: translate3d(0, 50%, 0);
|
||||||
@ -102,16 +102,15 @@
|
|||||||
.van-step__active {
|
.van-step__active {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: @green;
|
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&--vertical {
|
&--vertical {
|
||||||
|
padding: 10px 10px 10px 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 18px;
|
line-height: 18px;
|
||||||
padding: 10px 10px 10px 0;
|
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
border-bottom-width: 1px;
|
border-bottom-width: 1px;
|
||||||
@ -123,14 +122,14 @@
|
|||||||
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 1px;
|
|
||||||
height: 20px;
|
|
||||||
background-color: @white;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
left: -15px;
|
left: -15px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
width: 1px;
|
||||||
|
height: 20px;
|
||||||
|
background-color: @white;
|
||||||
|
content: '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,36 +14,5 @@ VantComponent({
|
|||||||
type: String,
|
type: String,
|
||||||
value: GREEN
|
value: GREEN
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
watch: {
|
|
||||||
steps: 'formatSteps',
|
|
||||||
active: 'formatSteps'
|
|
||||||
},
|
|
||||||
|
|
||||||
created() {
|
|
||||||
this.formatSteps();
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
|
||||||
formatSteps() {
|
|
||||||
const { steps } = this.data;
|
|
||||||
steps.forEach((step, index) => {
|
|
||||||
step.status = this.getStatus(index);
|
|
||||||
});
|
|
||||||
this.set({ steps });
|
|
||||||
},
|
|
||||||
|
|
||||||
getStatus(index) {
|
|
||||||
const { active } = this.data;
|
|
||||||
|
|
||||||
if (index < active) {
|
|
||||||
return 'finish';
|
|
||||||
} else if (index === active) {
|
|
||||||
return 'process';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,20 +1,35 @@
|
|||||||
<view class="custom-class van-steps van-steps--{{ direction }}">
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
|
|
||||||
|
<view class="custom-class {{ utils.bem('steps', [direction]) }}">
|
||||||
<view class="van-step__wrapper">
|
<view class="van-step__wrapper">
|
||||||
<view
|
<view
|
||||||
wx:for="{{ steps }}"
|
wx:for="{{ steps }}"
|
||||||
wx:key="index"
|
wx:key="index"
|
||||||
class="van-step van-hairline van-step--{{ direction }} {{ item.status ? 'van-step--' + item.status : '' }}"
|
class="{{ utils.bem('step', [direction, status(index, active)]) }} van-hairline"
|
||||||
style="{{ width ? 'width:' + width + 'px' : '' }}"
|
|
||||||
>
|
>
|
||||||
<view class="van-step__title" style="{{ item.status === 'process' ? 'color: ' + activeColor : '' }}">
|
<view class="van-step__title" style="{{ index === active ? 'color: ' + activeColor : '' }}">
|
||||||
<view>{{ item.text }}</view>
|
<view>{{ item.text }}</view>
|
||||||
<view>{{ item.desc }}</view>
|
<view>{{ item.desc }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="van-step__circle-container">
|
<view class="van-step__circle-container">
|
||||||
<view class="van-step__circle" wx:if="{{ item.status !== 'process' }}" style="{{ item.status === 'finish' ? 'background-color: ' + activeColor : '' }}" />
|
<view class="van-step__circle" wx:if="{{ index !== active }}" style="{{ index < active ? 'background-color: ' + activeColor : '' }}" />
|
||||||
<van-icon wx:else name="checked" color="{{ activeColor }}" custom-class="van-step__active" />
|
<van-icon wx:else name="checked" color="{{ activeColor }}" custom-class="van-step__active" />
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{ index !== steps.length - 1 }}" class="van-step__line" style="{{ item.status === 'finish' ? 'background-color: ' + activeColor : '' }}" />
|
<view wx:if="{{ index !== steps.length - 1 }}" class="van-step__line" style="{{ index < active ? 'background-color: ' + activeColor : '' }}" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<wxs module="status">
|
||||||
|
function get(index, active) {
|
||||||
|
if (index < active) {
|
||||||
|
return 'finish';
|
||||||
|
} else if (index === active) {
|
||||||
|
return 'process';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = get;
|
||||||
|
</wxs>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user