分享你我的心得.
共乘一片美好网络.

微信小程序实现水平时间轴

wxml

<view class="timeLine" style=" width: 100%;">
  <view class="on" wx:for="{{array}}" wx:key="Lsh"
    style="background:url('../images/ba.png') repeat-y 28.2% 0;">
    <p class="p" style="background: url('../images/icon.png') no-repeat 100% 0;background-size: 36rpx 36rpx;">
      {{item.CreateTime1}}<text class="text">{{item.CreateTime}}</text></p>
    <label class="con" >由用户<text class="name"> {{item.UserName}} </text>提供,将 ”{{item.text1}}“ 修改为 ”{{item.text2}}“ </label>
  </view>
</view>
<view class="END">
  <view>- THE END -</view>
</view>

wxss

page {
  margin: 0;
  padding: 0;
  background-color: #fff;
}

.timeLine {
  margin: 60rpx  0;
}

.on {
  padding-bottom: 30px;

  display: flex;
  width: 100%;
}

.timeLine view:last-child {
  padding-bottom: 2rpx;
}

.timeLine view:first-child {
  padding-top: 50rpx;
}

.p {
  width: 24%;
  font-size: 32rpx;
  font-weight: 300;
  text-align: right;
  padding-right: 50rpx;
  color: #377FFC;
  
}

.text {
  display: block;
  color: #9BBFFD;
  font-size: 12px;
}

.con {
  display: inline-block;
  padding-left: 30rpx;
  width: calc(100% - 300rpx);
  font-weight: 300;
  font-size: 28rpx;
}
.name{
  font-weight: 400;
}
.END {
  text-align: center;
  font-size: 24rpx;
  color: #999;
  padding: 30rpx 50rpx 30rpx 50rpx;
}

Js

const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    array:[{
    "CreateTime":"2022年09月10日",
    "CreateTime1":"11:24:19",
    "Lsh":"210319112419179022",
    "UserName":"11",
    "test1":"教师节",
    "test2":"教师的节日"
},{
    "CreateTime":"2022年08月01日",
    "CreateTime1":"11:24:19",
    "Lsh":"210319112419179022",
    "UserName":"11",
    "test1":"建军节",
    "test2":"军人的节日"
}]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
})
赞(0)
未经允许不得转载:小叶白龙博客 » 微信小程序实现水平时间轴
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址