当前位置:首页 > 开发教程 > js/jQuery教程 >

微信小程序实现Timeline时间线效果

时间:2022-05-23 09:29 来源:未知 作者:不忘初心 收藏

这篇文章主要为大家详细介绍了微信小程序实现Timeline时间线效果,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

微信小程序实现类似elementUI的Timeline时间线效果,自适应页面与文本

wxml代码:

<view class="box">
 <view wx:for="{{list}}" wx:key="index" class="one">
  <view class="onedot"></view>
  <view wx:if="{{index!=list.length-1}}" class="oneline"></view>
  <view class="onemain">
   <view class="onemaintitle">{{item.time}}</view>
   <view class="onemaincon">{{item.con}}</view>
  </view>
 </view>
</view>

wxss代码:

.box {
 padding: 30rpx;
}
.one {
 position: relative;
 padding-bottom: 40rpx;
}
.onedot {
 left: -2rpx;
 width: 24rpx;
 height: 24rpx;
 position: absolute;
 background-color: #67c23a;
 border-radius: 50%;
 display: flex;
 justify-content: center;
 align-items: center;
 z-index: 1;
}
.oneline {
 position: absolute;
 left: 8rpx;
 height: 100%;
 border-left: 2px solid #e4e7ed;
}
.onemain {
 position: relative;
 padding-left: 56rpx;
 top: -6rpx;
}
.onemaintitle {
 margin-bottom: 16rpx;
 padding-top: 8rpx;
 color: #909399;
 line-height: 1;
 font-size: 26rpx;
}
.onemaincon {
 color: #303133;
}

js代码:

data: {
  list: [{
   time: "2021-02-02 10:30:30",
   con: "这是主要内容部分"
  },{
   time: "2021-02-02 10:30:30",
   con: "这是主要内容部分这是主要内容部分这是主要内容部分这是主要内容部分这是主要内容部分"
  },{
   time: "2021-02-02 10:30:30",
   con: "这是主要内容部分这是主要内容部分这是主要内容部分这是主要内容部分"
  }]
 },

最终效果:

微信小程序实现Timeline时间线效果

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持源码搜藏网。


下一篇:没有了

js/jQuery教程阅读排行

最新文章