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

html 复制代码
<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>
js 复制代码
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    active: Number
  },
  
  /**
   * 组件的初始数据
   */
  data: {
      stepInfo: [{
        pro_name: '11111'
      },
      {
        pro_name: '22222'
      },
      {
        pro_name: '33333'
      },
      {
        pro_name: '44444'
      },
    ],
  },
  
})
css 复制代码
/* 步骤条 */
.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;
}
相关推荐
HERR_QQ1 天前
【unify】unify的微信小程序开发学习 (to be continued)
学习·微信小程序·小程序
racerun1 天前
小程序导航设置更多内容的实现方法
小程序
说私域1 天前
基于开源AI智能名片链动2+1模式S2B2C商城小程序的超级文化符号构建路径研究
人工智能·小程序·开源
mg6681 天前
微信小程序入门实例_____快速搭建一个快递查询小程序
微信小程序·小程序
程序员柳1 天前
基于微信小程序的校园二手交易平台、微信小程序校园二手商城源代码+数据库+使用说明,layui+微信小程序+Spring Boot
数据库·微信小程序·layui
Jyywww1211 天前
微信小程序学习笔记
笔记·学习·微信小程序
The_era_achievs_hero1 天前
微信小程序41~50
微信小程序·小程序
走,带你去玩2 天前
uniapp 微信小程序水印
微信小程序·小程序·uni-app
是一碗螺丝粉2 天前
🔥 微信H5视频自动播放终极秘籍:WeixinJSBridge竟是官方“通行证”?
微信小程序