【uniapp】自定义步骤条样式

代码实现

<view class="steps-wrap">
  <view class="flex-box">
    <view class="number active-number">1</view>
    <view class="desc active-desc">步骤1</view>
    <view :class="['line', activeStep == 1 ? 'line1' : 'line3']"></view>
  </view>
  <view class="flex-box">
    <view :class="['number', activeStep == 1 ? '' : 'active-number']">2</view>
    <view :class="['desc', activeStep != 1 ? 'active-desc' : '']">步骤2</view>
    <view :class="['line', activeStep == 1 ? 'line2' : activeStep == 2 ? 'line1' : 'line3']"></view>
  </view>
  <view class="flex-box">
    <view :class="['number', activeStep == 3 ? 'active-number' : '']">3</view>
    <view :class="['desc', activeStep == 3 ? 'active-desc' : '']">步骤3</view>
  </view>
</view>
.steps-wrap {
   
  padding: 36rpx 0 0;
  display: flex;
  align-items: center;
  .flex-box {
   
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
  }
  .number {
   
    position: relative;
    z-index: 5;
    width: 40rpx;
    height: 40rpx;
    background: #9cccff;
    color: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24rpx;
  }
  .active-number {
   
    background: var(--recruit-color);
  }
  .desc {
   
    font-size: 24rpx;
    color: #c8c8c8;
    line-height: 34rpx;
    margin-top: 20rpx;
    font-weight: 500;
    text-align: center;
  }
  .active-desc {
   
    color: #484848;
  }
  .line {
   
    position: absolute;
    top: 18rpx;
    left: 50%;
    z-index: 1;
    width: 100%;
    height: 4rpx;
  }
  .line1 {
   
    background: linear-gradient(90deg, #3a9aff 0%, #9cccff 21%, #9cccff);
  }
  .line2 {
   
    background: #9cccff;
  }
  .line3 {
   
    background: var(--recruit-color);
  }
}

相关推荐

  1. uniapp定义步骤样式

    2024-02-19 06:36:04       44 阅读
  2. uniapp步骤 组件

    2024-02-19 06:36:04       34 阅读

最近更新

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

    2024-02-19 06:36:04       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-02-19 06:36:04       100 阅读
  3. 在Django里面运行非项目文件

    2024-02-19 06:36:04       82 阅读
  4. Python语言-面向对象

    2024-02-19 06:36:04       91 阅读

热门阅读

  1. uni-app自定义tabbar(van-tabbar)

    2024-02-19 06:36:04       48 阅读
  2. AI趋势(06) Sora,AI对世界的新理解

    2024-02-19 06:36:04       50 阅读
  3. react 实现路由拦截

    2024-02-19 06:36:04       48 阅读
  4. 深入理解nginx的动态变量机制【上】

    2024-02-19 06:36:04       37 阅读
  5. golang 获取域名 ip dns 信息

    2024-02-19 06:36:04       53 阅读
  6. Redis分布式可重入锁实现方案

    2024-02-19 06:36:04       41 阅读
  7. 正则表达式的应用

    2024-02-19 06:36:04       40 阅读
  8. AJAX.

    AJAX.

    2024-02-19 06:36:04      55 阅读