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

在这里插入图片描述

<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>
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    active: Number
  },
  
  /**
   * 组件的初始数据
   */
  data: {
      stepInfo: [{
        pro_name: '11111'
      },
      {
        pro_name: '22222'
      },
      {
        pro_name: '33333'
      },
      {
        pro_name: '44444'
      },
    ],
  },
  
})
/* 步骤条 */
.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. 程序定义组件

    2024-04-12 10:44:02       46 阅读
  2. 程序定义头部

    2024-04-12 10:44:02       31 阅读
  3. 程序中使用定义 icon 图标

    2024-04-12 10:44:02       57 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-12 10:44:02       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-12 10:44:02       101 阅读
  3. 在Django里面运行非项目文件

    2024-04-12 10:44:02       82 阅读
  4. Python语言-面向对象

    2024-04-12 10:44:02       91 阅读

热门阅读

  1. 速盾:为什么会出现高防cdn?它适合哪些行业?

    2024-04-12 10:44:02       94 阅读
  2. symfony框架介绍

    2024-04-12 10:44:02       37 阅读
  3. C#泛型的逆变协变

    2024-04-12 10:44:02       150 阅读
  4. C语言—每日选择题—Day70(需要看)

    2024-04-12 10:44:02       36 阅读
  5. svdpi.h源码

    2024-04-12 10:44:02       27 阅读
  6. 代码随想录算法训练营第四十四天|leetcode309、714题

    2024-04-12 10:44:02       106 阅读
  7. ORACLE查看数据库中用户,用户创建修改

    2024-04-12 10:44:02       123 阅读
  8. 力扣爆刷第117天之CodeTop100五连刷71-75

    2024-04-12 10:44:02       31 阅读