vue如何實(shí)現(xiàn)自定義步驟條
更新時間:2023年12月02日 16:37:16 作者:dearqz
這篇文章主要介紹了vue如何實(shí)現(xiàn)自定義步驟條問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
vue自定義步驟條
首先看一下實(shí)現(xiàn)的效果:

來看看實(shí)現(xiàn)過程:
公共插件
<!-- Step.vue -->
<template>
<div class="stepOut">
<ul>
<li class="stepItem" v-for="(stepItem, index) in stepInfo.list" :key="index">
<!-- 模擬步驟條的節(jié)點(diǎn),此處為圓圈 -->
<div :class="stepInfo.step >= index+1 ? 'icon active':'icon'"></div>
<!-- 模擬步驟條連接線,動態(tài)顯示 -->
<div :class="stepInfo.step >= index+2 ? 'line lineActive':'line'" v-show="index!==stepInfo.list.length-1"></div>
<!-- 步驟名稱 -->
<p class="stepStatus">{{stepItem.status}}</p>
<!-- 步驟時間 -->
<p class="statusTime">{{stepItem.statusTime}}</p>
</li>
</ul>
</div>
</template><script>
export default {
name: 'steps',
props: {
// 傳遞步驟參數(shù)
stepInfo: {
type: Object,
default: function () {
return {
list: [],
step: 0
}
}
}
}
}
</script><style lang="less" scoped>
.stepOut {
width: 100%;
height: 70px;
display: flex;
justify-content: center;
.stepItem {
width: 260px;
height: 70px;
float: left;
font-family: SimSun;
font-size: 16px;
text-align: center;
position: relative;
.icon {
width: 13px;
height: 13px;
border-radius: 50%;
background: rgba(226, 226, 226, 1);
margin: 0 auto;
position: relative;
z-index: 888;
}
.active {
background-color: green;
}
.line {
position: absolute;
top: 6px;
left: 50%;
border-bottom: 1px dashed rgba(3, 2, 2, 0.7);
width: 260px;
z-index: 111;
}
.lineActive {
border-bottom: 1px solid green;
}
.stepStatus {
color: rgba(87, 87, 87, 1);
line-height: 36px;
}
.statusTime {
color: rgba(87, 87, 87, 1);
opacity: 0.5;
}
}
}
</style>使用
<template>
<div class="main">
<Steps :stepInfo="stepInfo"></Steps>
</div>
</template><script>
import Steps from '@/components/Steps'
export default {
components: { Steps },
data () {
return {
stepInfo: {
list: [{ status: '提現(xiàn)申請?zhí)峤怀晒?,令額凍結(jié)', statusTime: '2019-11-8 12:12:12' },...],
step: 2
}
}
}
}
</script>
總結(jié)
以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
在 Vue3 中如何使用 styled-components
styled-components 的官方 Vue 版本目前已多年沒有更新,而且只支持到 Vue2,那么,在 Vue3 中怎么才能使用到 styled-components 呢,下面給大家介紹在 Vue3 中使用 styled-components的相關(guān)知識,感興趣的朋友跟隨小編一起看看吧2024-05-05
關(guān)于vue-resource報錯450的解決方案
本篇文章主要介紹關(guān)于vue-resource報錯450的解決方案,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-07-07
vue使用driver.js完成頁面引導(dǎo)功能的示例詳解
在Vue中,driver.js通常是指用于實(shí)現(xiàn)用戶引導(dǎo)和教程功能的JavaScript庫,它可以幫助開發(fā)者在應(yīng)用程序中創(chuàng)建交互式的引導(dǎo)和教程,以引導(dǎo)用戶了解應(yīng)用程序的不同功能和界面,本文就簡單的給大家介紹一下vue如何使用driver.js完成頁面引導(dǎo)功能2023-08-08
vue 使用eventBus實(shí)現(xiàn)同級組件的通訊
這篇文章主要介紹了vue 使用eventBus實(shí)現(xiàn)同級組件的通訊,需要的朋友可以參考下2018-03-03
Vue結(jié)合leaflet實(shí)現(xiàn)克里金插值
本文主要介紹了Vue結(jié)合leaflet實(shí)現(xiàn)克里金插值,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06

