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

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;
}
相关推荐
2501_9160074712 小时前
苹果手机iOS应用管理全指南与隐藏功能详解
android·ios·智能手机·小程序·uni-app·iphone·webview
Gracemark13 小时前
H5回调页开发与调试复盘
微信小程序
yogalin199313 小时前
微信小程序代码复用技巧
性能优化·微信小程序
求学中--13 小时前
进阶实战:构建一个完整的微信小程序博客系统(含云开发与状态管理)
微信小程序·小程序
2501_9151063215 小时前
全面理解 iOS 帧率,构建从渲染到系统行为的多工具协同流畅度分析体系
android·ios·小程序·https·uni-app·iphone·webview
计算机毕设指导617 小时前
基于微信小程序的宠物走失信息管理系统【源码文末联系】
java·spring boot·mysql·微信小程序·小程序·tomcat·宠物
2501_9160088917 小时前
iOS 能耗检测的工程化方法,构建多工具协同的电量分析与性能能效体系
android·ios·小程序·https·uni-app·iphone·webview
说私域17 小时前
基于开源链动2+1模式AI智能名片S2B2C商城小程序的线上向线下导流运营研究
人工智能·小程序·开源
小小王app小程序开发17 小时前
任务悬赏小程序核心玩法 + 功能全解析:精准匹配与信任构建的变现逻辑
大数据·小程序
头发还在的女程序员17 小时前
陪诊小程序成品|陪诊系统功能|陪诊系统功能(源码)
java·小程序·his系统