当前位置:网站首页>vant3 +ts 封装简易step进步器组件
vant3 +ts 封装简易step进步器组件
2022-06-12 17:41:00 【热忱学习】

公司需要这样的step 进度条,vant组件提供的有点难改,所以自己就在网上找了一个,做了一些改动

step 组件 用的时候改变stepActive的值
<template>
<div style="background-color: white">
<div class="steps">
<div class="step" v-for="(i, index) in stepList" :key="index">
<div class="step-head" :class="
activeValue == i.stepIndex || i.stepIndex <= activeValue
? 'step-finish'
: 'step-wait'
">
<div class="step-line" :class="
activeValue == i.stepIndex + 1 || i.stepIndex + 1 <= activeValue
? 'step-finish'
: 'step-wait'
">
<i class="step-line-inner"></i>
</div>
<div v-if="activeValue==i.stepIndex" class="step-img">
<img src="@/assets/img/set_on.png" alt="">
</div>
<div v-else-if="i.stepIndex + 1 <= activeValue" class="step-img">
<img src="@/assets/img/step_su.png" alt="">
</div>
<div class="step-icon" v-else :class="{ active: activeValue + 1 === i.stepIndex }">
<div class="step-icon-text">{
{ i.stepIndex }}</div>
</div>
</div>
<div class="step-main" :class="
activeValue == i.stepIndex || i.stepIndex <= activeValue
? 'step-finish'
: 'step-wait'
">
<div class="step-title" :class="{ active: activeValue + 1 === i.stepIndex }">
{
{ i.title }}
</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { defineComponent, reactive, ref, toRefs } from 'vue'
interface Props {
activeValue: number //文件地址-双向绑定
}
const props = withDefaults(defineProps<Props>(), {
activeValue: 1,
})
// const activeValue = ref(2);
const stepList = ref();
//步骤条步数
stepList.value = [
{
stepIndex: 1,
title: "待处理",
},
{
stepIndex: 2,
title: "处理中",
},
{
stepIndex: 3,
title: "已完成",
},
];
</script>
<style lang="scss" scoped>
.steps {
display: flex;
text-align: center;
.step {
flex-basis: 33%;
margin-right: 0px;
.step-head {
position: relative;
width: 100%;
.step-line {
left: 67%;
right: -36%;
height: 0.1px;
top: 31px;
position: absolute;
border: 1px solid;
border-color: inherit;
// background-color: #c0c4cc;
.step-line-inner {
transition-delay: 0ms;
// border-width: 1px;
width: 100%;
display: block;
// border: 1px solid;
// border-color: inherit;
transition: 0.15s ease-out;
box-sizing: border-box;
width: 0;
height: 0;
}
}
.step-icon {
position: relative;
z-index: 1;
display: inline-flex;
justify-content: center;
align-items: center;
width: 20px;
height: 20px;
font-size: 12px;
box-sizing: border-box;
background: #c8c9cc;
// transition: 0.15s ease-out;
border-radius: 50%;
// border: 2px solid;
// border-color: inherit;
&.active {
color: #333 !important;
}
.step-icon-text {
display: inline-block;
user-select: none;
text-align: center;
font-weight: 700;
line-height: 1;
color: #fff;
}
}
.step-img{
// display: flex;
// align-items: center;
// margin-right: 36px;
img{
// display: inline-block;
width: 20px;
height: 20px;
vertical-align:bottom
}
}
}
.step-main {
.step-title {
font-size: 14px;
line-height: 38px;
// font-weight: 700;
text-align: center;
color: #6E6E6E;
&.active {
color: #3C3C3C !important;
}
}
}
}
.step:last-of-type .step-line {
display: none;
}
//当前所在位置样式
.step-finish {
color: #EE0A24;
}
.step-wait {
color: #dcdee0;
}
}
</style>
边栏推荐
- 566. 重塑矩阵
- 山东大学软件学院项目实训-创新实训-山大软院网络攻防靶场实验平台(二十五)-项目个人总结
- Risc-v ide mounriver studio v1.60 update point introduction
- Lambda - 1
- Learn the mitmproxy packet capturing tool from scratch
- 認識函數原創
- Qiushengchang: Practice of oppo commercial data system construction
- The significance of writing technology blog
- C# 业务流水号规则生成组件
- Introduction to several common functions of fiddler packet capturing (stop packet capturing, clear session window contents, filter requests, decode, set breakpoints...)
猜你喜欢

JDBC几个坑

Volcano engine held a video cloud technology force summit and released a new experience oriented video cloud product matrix

Qiushengchang: Practice of oppo commercial data system construction

JDBC several pits

Deep interest evolution network for click through rate prediction

JDBC快速入门教程

Selenium element positioning

Gerrit+2 triggers Jenkins task

Message queuing MySQL tables that store message data

Cesium parabolic equation
随机推荐
The R language uses the tablestack function of epidisplay package to generate statistical analysis tables based on grouped variables (including descriptive statistical analysis, hypothesis test, diffe
(3) Golang - data type
Soringboot下RestTemplateConfig 配置打印请求响应日志
消息队列存储消息数据的 MySQL 表格
grpc-swift入门
Array sorts in the specified order
Use the official go Library of mongodb to operate the original mongodb
Is it cost-effective to apply for Huagui sweet home term life insurance? What are the advantages of this product?
R language arma-garch-copula model and financial time series case
Introduction of one object one code tracing system
新媒体运营素材网站分享,让你创作时事半功倍
R language calculates data Table specifies the mean value of a numeric variable when the value of one grouped variable is fixed and another grouped variable
office应用程序无法正常启动0xc0000142
118. Yanghui triangle (dynamic planning)
Quick start sweep crawler framework
(8) Goto keyword
First acquaintance with go language
Selenium element positioning
Some introduction to FPC flexible circuit board design
I heard that distributed IDS cannot be incremented globally?