这篇文章主要介绍“微信小程序如何实现水平时间轴”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“微信小程序如何实现水平时间轴”文章能帮助大家解决问题。
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' ></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' ></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' ></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' ></view>
</view>
</view>
<view class="weui-flex__item wehx-line-item">
<view class='line-name'>等待确认费用</view>
<view class='weui-cell-list'>
<view class='line' ></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' ></view>
</view>
</view>
<view class="weui-flex__item wehx-line-item">
<view class='line-name'>未付款</view>
<view class='weui-cell-list'>
<view class='line' ></view>
<view class="dot {{item.finished?'dotActive':''}}"></view>
<view class='line' ></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({
/**
1. 页面的初始数据
*/
data: {
axis:[
{
name:'待成交',
star:'none',
end: '#d5d8dd',
},
{
name: '等待确认费用',
star:'#d5d8dd',
end: '#d5d8dd',
},
{
name: '未付款',
star:'#d5d8dd',
end: 'none',
},
]
},
/**
2. 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
3. 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
4. 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
5. 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
6. 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
7. 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
8. 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
9. 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
最终效果如图所示:
关于“微信小程序如何实现水平时间轴”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注亿速云行业资讯频道,小编每天都会为大家更新不同的知识点。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。