vue如何實(shí)現(xiàn)自定義步驟條
vue自定義步驟條
首先看一下實(shí)現(xiàn)的效果:

來(lái)看看實(shí)現(xiàn)過(guò)程:
公共插件
<!-- 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>
<!-- 模擬步驟條連接線(xiàn),動(dòng)態(tài)顯示 -->
<div :class="stepInfo.step >= index+2 ? 'line lineActive':'line'" v-show="index!==stepInfo.list.length-1"></div>
<!-- 步驟名稱(chēng) -->
<p class="stepStatus">{{stepItem.status}}</p>
<!-- 步驟時(shí)間 -->
<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)申請(qǐng)?zhí)峤怀晒Γ铑~凍結(jié)', statusTime: '2019-11-8 12:12:12' },...],
step: 2
}
}
}
}
</script>
總結(jié)
以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Vue input輸入框中的值如何變成黑點(diǎn)問(wèn)題
這篇文章主要介紹了Vue input輸入框中的值如何變成黑點(diǎn)問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-04-04
在 Vue3 中如何使用 styled-components
styled-components 的官方 Vue 版本目前已多年沒(méi)有更新,而且只支持到 Vue2,那么,在 Vue3 中怎么才能使用到 styled-components 呢,下面給大家介紹在 Vue3 中使用 styled-components的相關(guān)知識(shí),感興趣的朋友跟隨小編一起看看吧2024-05-05
關(guān)于vue-resource報(bào)錯(cuò)450的解決方案
本篇文章主要介紹關(guān)于vue-resource報(bào)錯(cuò)450的解決方案,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-07-07
vue使用driver.js完成頁(yè)面引導(dǎo)功能的示例詳解
在Vue中,driver.js通常是指用于實(shí)現(xiàn)用戶(hù)引導(dǎo)和教程功能的JavaScript庫(kù),它可以幫助開(kāi)發(fā)者在應(yīng)用程序中創(chuàng)建交互式的引導(dǎo)和教程,以引導(dǎo)用戶(hù)了解應(yīng)用程序的不同功能和界面,本文就簡(jiǎn)單的給大家介紹一下vue如何使用driver.js完成頁(yè)面引導(dǎo)功能2023-08-08
VUE屏幕整體滾動(dòng)(滑動(dòng)或滾輪)原生方法舉例
為了實(shí)現(xiàn)全屏滾動(dòng)效果,我們首先需要使用Vue.js框架搭建項(xiàng)目,這篇文章主要給大家介紹了關(guān)于VUE屏幕整體滾動(dòng)(滑動(dòng)或滾輪)原生方法的相關(guān)資料,需要的朋友可以參考下2024-01-01
vue 使用eventBus實(shí)現(xiàn)同級(jí)組件的通訊
這篇文章主要介紹了vue 使用eventBus實(shí)現(xiàn)同級(jí)組件的通訊,需要的朋友可以參考下2018-03-03
Vue結(jié)合leaflet實(shí)現(xiàn)克里金插值
本文主要介紹了Vue結(jié)合leaflet實(shí)現(xiàn)克里金插值,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06

