本文实例为大家分享了微信小程序实现水平时间轴的具体代码,供大家参考,具体内容如下 1、wxml部分代码如下: <view class="wehx-line-box">
本文实例为大家分享了微信小程序实现水平时间轴的具体代码,供大家参考,具体内容如下
1、wxml部分代码如下:
<view class="wehx-line-box">
<view class="weui-flex__item wehx-line-item" wx:for="{{axis}}" wx:key="*this">
<view class='line-name'>{{item.name}}</view>
<view class='weui-cell-list'>
<view class='line' style="background:{{item.star}}"></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' style="background:{{item.end}}"></view>
</view>
</view>
</view>
或者:
<view class="wehx-line-box">
<view class="weui-flex__item wehx-line-item">
<view class='line-name'>待成交</view>
<view class='weui-cell-list'>
<view class='line' style="background:none;"></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' style="background:{{item.end}}"></view>
</view>
</view>
<view class="weui-flex__item wehx-line-item">
<view class='line-name'>等待确认费用</view>
<view class='weui-cell-list'>
<view class='line' style="background:{{item.star}}"></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' style="background:{{item.end}}"></view>
</view>
</view>
<view class="weui-flex__item wehx-line-item">
<view class='line-name'>未付款</view>
<view class='weui-cell-list'>
<view class='line' style="background:{{item.star}}"></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' style="background:none;"></view>
</view>
</view>
</view>
wxss部分代码如下:
.wehx-line-box{
display: flex;
height: 90rpx;
border-top: 1rpx dashed #e5e5e5;
padding: 30rpx 0;
}
.wehx-line-item{
display:flex;flex-direction:column;justify-content:space-between;align-items:center;
}
.weui-cell-list{
display:flex;align-items:center;justify-content:space-between;width:100%;
}
.line{
width:43%;
height:2rpx;
background: #d5d8dd;
}
.dot{
border-radius: 50%;
width: 10px;
height: 10px;
margin-right: 4rpx;
background: #d5d8dd;
}
.dotActive{
background: #2ea7e0;
}
.line-name{
font-size:30rpx;
}
js部分代码如下所示:
// pages/market/detail/detail.js
Page({
data: {
axis:[
{
name:'待成交',
star:'none',
end: '#d5d8dd',
},
{
name: '等待确认费用',
star:'#d5d8dd',
end: '#d5d8dd',
},
{
name: '未付款',
star:'#d5d8dd',
end: 'none',
},
]
},
onLoad: function (options) {
},
onReady: function () {
},
onShow: function () {
},
onHide: function () {
},
onUnload: function () {
},
onPullDownRefresh: function () {
},
onReachBottom: function () {
},
onShareAppMessage: function () {
}
})
最终效果如图所示:
--结束END--
本文标题: 微信小程序实现水平时间轴
本文链接: https://lsjlt.com/news/149393.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-01-12
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
2023-05-20
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0