当前位置:   article > 正文

【微信小程序自定义封装步骤条】

【微信小程序自定义封装步骤条】

在这里插入图片描述

<view class="progresscon" >
<view class="head">
  <block wx:for="{{stepInfo}}" wx:key='list' wx:for-item="item" wx:for-index="index">
      <view class="boxprgoress">
        <span wx:if="{{index==active}}" class="head_icon head_iconactive">
          <span></span>
        </span>
        <span wx:else class="head_icon"></span>
        <view class="head_info">
          <view class="head_title">{{item.pro_name}}</view>
        </view>
      </view>
    </block>
</view>
  
</view>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    active: Number
  },
  
  /**
   * 组件的初始数据
   */
  data: {
      stepInfo: [{
        pro_name: '11111'
      },
      {
        pro_name: '22222'
      },
      {
        pro_name: '33333'
      },
      {
        pro_name: '44444'
      },
    ],
  },
  
})
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
/* 步骤条 */
.progresscon{
  background: #ccc;
  padding: 60rpx 40rpx 0rpx;
}

.head {
  height:120rpx;
  margin-left: 40rpx;
}
.boxprgoress{
  border-top: 1px solid #fff;
  position: relative;
  width:200rpx;
  height: 100rpx;
  float: left;
}
.boxprgoress:last-child{
  border-top: 0;
  width: 0;
}
.head_info {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  top: 40rpx;
}

.head_icon {
  width: 40rpx;
  height: 40rpx;
  z-index: 1;
  box-sizing: border-box;
  border: 2px solid #fff;
  float: left;
  background: #498AFD;
  border-radius: 50%;
  margin: 0 auto;
  position: absolute;
  top: -20rpx;
  left: 0;
  transform: translateX(-50%);
  text-align: center  ;
}
/* 选中 */
.head_iconactive{
  width: 48rpx;
  height: 48rpx;
  line-height: 44rpx;
}
/* 选中后里面span圆形的样式 */
.head_iconactive span{
  width: 28rpx;
  height: 28rpx;
  background-color: #fff;
  display: inline-block;
  border-radius: 50%;
  margin: 0 auto;
}


.head_title {
  padding-top: 20rpx;
  font-size: 24rpx;
  line-height: 28rpx;
  color: #fff;
  min-width: 100rpx;
}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/437388
推荐阅读
相关标签
  

闽ICP备14008679号