当前位置:网站首页>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>
边栏推荐
- Application case of smart micro 32-bit MCU for server application cooling control
- 徽商期货公司开户可靠,交易安全吗?
- String s = null ; String s = new String();String s =““ ;String s ;有什么区别?
- How to change Golan back to the English version when it becomes the Chinese version
- 消息队列实战之队列优先级
- 406. 根据身高重建队列
- Alibaba cloud image station supports IPv6!
- 内核中断整体流程图
- Go variables
- qemu+gdb小节
猜你喜欢
Hangzhou AI developer meetup registration opens!
消息队列实战之队列优先级
Tcp/ip family structure and protocol of tcp/ip series overview
C#操作数据库增查业务数据值内容案例学校表
淘宝Native研发模式的演进与思考 | DX研发模式
Hangzhou AI developer meetup registration opens!
Detailed explanation of shardingjdbc database and table
The significance of writing technology blog
Deep interest evolution network for click through rate prediction
MySQL学习笔记
随机推荐
Alibaba cloud image station supports IPv6!
Introduction of one object one code tracing system
First acquaintance with go language
字节飞书人力资源套件三面
1.5 什么是架构师(连载)
LCD参数解释及计算
徽商期货公司开户可靠,交易安全吗?
Detailed description of SQL cursor and example of internal recycling
The R language uses the tabpct function of the epidisplay package to generate a two-dimensional contingency table, and uses the mosaic diagram to visualize the contingency table (two-dimensional conti
error接口原创
(8) Goto keyword
Selenium element positioning
R language uses ggplot2 to visualize the density graph (curve) of specific data columns in dataframe data, and uses Xlim parameter to specify the range of X axis
String的split方法的使用
Reconnaître l'originalité de la fonction
Kali2022 installing Armitage
R语言使用ggplot2可视化dataframe数据中特定数据列的密度图(曲线)、并使用xlim参数指定X轴的范围
Application case of smart micro 32-bit MCU for server application cooling control
qemu+gdb小节
系统设计之图状数据模型