微信小程序之步骤条(Steps)

一、效果图及简介:

在这里插入图片描述
(1)没完成的灰色小圆点表示
(2)完成的使用绿色小圆点设表示
(3)完成的最后一个步骤用代√的小圆点表示

二、实现思路:

(1)progress进度条:
开发文档查看属性:https://developers.weixin.qq.com/miniprogram/dev/component/progress.html
(2)view圆点样式:

wxml:

<view class='{{Steps==index?"steps":Steps<index?"steps3":"steps2"}}'></view>

wxss:

.steps{
  width: 50rpx;
  height: 50rpx;
  border-radius: 50%;
  background-color: rgb(25, 185, 3);
  text-align: center;
}

三、素材图片下载:

在这里插入图片描述

四、实现代码:

wxml:

<view class="steps_box">
  <progress percent="{{Steps*percent}}"  class="progress" stroke-width="3" color="rgb(25, 185, 3)" backgroundColor="rgb(185, 187, 190)" style="width:{{progress}}%"/>
  <view class="steps_all">
    <view class="steps_one_box" wx:for="{{StepsList}}" wx:key="index">
      <view class='{{Steps==index?"steps":Steps<index?"steps3":"steps2"}}'>
        <image wx:if="{{Steps==index}}" src="../../images/order_icon.png" class="steps_img"></image>
      </view>
      <view class="{{Steps>=index?'steps_wenzi':'steps_wenzi2'}}" >{{StepsList[index]}}</view>
    </view>
  </view>
</view>

wxss:

/* 步骤条 */
page{
  background-color: rgb(190, 236, 238);
}
.steps_box{
  margin-top: 200rpx;
  width: 90%;
  margin: auto;
  background-color: white;
  height: 200rpx;
  position:relative;
}
.progress{
  margin: auto;
  margin-top: 75rpx;
}
.steps_all{
  width: 100%;
  position: absolute;
  right: 0;
  top: 50rpx;
  display:flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
}
.steps_one_box{
  height: 100%;
  width: 20%;
  display:flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.steps{
  width: 50rpx;
  height: 50rpx;
  border-radius: 50%;
  background-color: rgb(25, 185, 3);
  text-align: center;
}
.steps_img{
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.steps2{
  width: 35rpx;
  height: 35rpx;
  border-radius: 50rpx;
  background-color: rgb(25, 185, 3);
  text-align: center;
}
.steps3{
  width: 35rpx;
  height: 35rpx;
  border-radius: 50rpx;
  background-color: rgb(185, 187, 190);
  text-align: center;
}
.steps_wenzi{
  margin-top: 40rpx;
  font-size: 25rpx;
}
.steps_wenzi2{
  margin-top: 40rpx;
  font-size: 25rpx;
  color: rgb(112, 113, 114);
}

js:

Page({

  /**
   * 页面的初始数据
   */
  data: {
    //设置当前完成步数
    Steps:2,

  // 当步骤为五步时步骤名不可超过五个汉字
    StepsList: ["第一步", "第二步", "第三步", "第四步", "第五步"],
  //步骤为五步时
    progress:80,
    percent:25,
  // //步骤为四步时
  //   progress: 75,
  //   percent: 33,
  // //步骤为三步时
  //   progress: 67,
  //   percent: 50,
  },

})
  • 5
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
开发微信小程序步骤如下: 1. 注册小程序账号:首先,你需要在微信公众平台注册一个小程序账号。访问微信公众平台官网(https://mp.weixin.qq.com/),点击"注册"按钮,按照指引填写相关信息完成注册。 2. 创建小程序:注册成功后,登录微信公众平台,点击"开发"选项进入小程序管理页面。在页面上方的"小程序"选项卡中,点击"创建小程序"按钮,填写小程序的基本信息,包括小程序名称、AppID、所属行业等。 3. 开发工具准备:下载并安装微信开发者工具(https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html)。这是一个集成了代码编辑、调试、预览和发布等功能的开发工具。 4. 开发环境配置:打开微信开发者工具,使用小程序账号登录。在登录成功后,点击左上角的"新建项目"按钮,填写项目名称、AppID和项目目录等信息。 5. 编写代码:在微信开发者工具中,你可以使用类似于HTML、CSS和JavaScript的语言来编写小程序的前端代码。你可以使用微信提供的组件和API来实现各种功能,如界面布局、数据交互、网络请求等。 6. 调试和预览:在编写代码的过程中,你可以通过微信开发者工具进行实时的调试和预览。工具会模拟真实的小程序环境,你可以在工具中查看小程序的界面效果和功能表现。 7. 测试和发布:完成代码编写后,你可以在微信开发者工具中进行测试。测试通过后,你可以将小程序提交给微信官方审核。审核通过后,你就可以将小程序发布到微信平台上供用户使用。 总结一下,开发微信小程序步骤包括注册小程序账号、创建小程序、准备开发工具、配置开发环境、编写代码、调试和预览、测试和发布。通过这些步骤,你可以开发出功能丰富的微信小程序
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Memory沙漏

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值