uniapp實現(xiàn)審批流程的具體操作步驟
一、實現(xiàn)思路
需要要定義一個變量, 記錄當(dāng)前激活的步驟。通過數(shù)組的長度來循環(huán)數(shù)據(jù),如果有就采用3元一次進行選擇。
把循環(huán)里面的變量【name、status、time】, 全部替換為取出的那一項的值。然后繼續(xù)下一次循環(huán)。
虛擬的數(shù)據(jù)都是請求來的, 組裝為好渲染的格式。
二、實現(xiàn)步驟
①view部分展示
如果有看不懂的代碼,請繼續(xù)往下看,會有解釋?。。?/p>
<view class="container" style="margin: 24rpx 0;">
<view class="overbold" style="margin-bottom: 40rpx;">審批</view>
<template v-for="(item,index) in funList.RenList">
<view :key="index" class="flex"
:style="{ marginBottom: index === funList.RenList.length - 1 ? '24rpx' : '68rpx' }">
<view class="img-box">
<image class="figure" :src="item.image" mode="aspectFill"></image>
<view v-if="index != funList.RenList.length - 1" class="line">
</view>
</view>
<view style="margin-left: 20rpx;">
<view class="flex" style="width: 518rpx;">
<view class="changwrod" style="margin-bottom: 8rpx;width: 60%;">{{ item.name }}</view>
<view v-if="item.status == 1" class="smallword" style="color: #999;">{{ item.time }}
</view>
</view>
<view v-if="item.status == 1" class="smallword" style="color: #31BA3E;">已通過</view>
<view v-if="item.status == 0" class="smallword" style="color: #666;">待審批</view>
</view>
</view>
</template>
</view>代碼解釋:
代碼解釋:
funList.RenList:對象中的數(shù)組【考慮到后期交互,也可能單獨拿出來】
:style="{ marginBottom: index === funList.RenList.length - 1 ? '24rpx' : '68rpx' }"
這段代碼是一個動態(tài)的樣式綁定,它根據(jù)條件來設(shè)置元素的 marginBottom 樣式屬性的值。
具體解釋如下:
:style 是 Vue/uni-app 中用來動態(tài)綁定樣式的語法。
marginBottom 是 CSS 中的屬性,用來設(shè)置元素的下邊距。
index === funList.RenList.length - 1 是一個條件判斷表達式,表示如果當(dāng)前元素的索引(index)等于 funList.RenList 數(shù)組的長度減 1。
? '24rpx' : '68rpx' 是一個三元表達式,用于根據(jù)條件判斷結(jié)果設(shè)置不同的值。如果條件為真,即當(dāng)前元素是最后一個元素,那么設(shè)置下邊距為 '24rpx';否則,設(shè)置下邊距為 '68rpx'。換句話說,這段代碼的作用是:如果當(dāng)前元素是 funList.RenList 數(shù)組中的最后一個元素,則設(shè)置它的下邊距為 '24rpx';否則,設(shè)置下邊距為 '68rpx'。
②JavaScript 內(nèi)容
funList: {
//。。。。。交互內(nèi)容
RenList: [{
image: 'https://cdn.uviewui.com/uview/album/1.jpg',
name: "葉玲",
time: "2023.12.03 10:30",
status: 1 // 1已審核 0未審核
}, {
image: 'https://cdn.uviewui.com/uview/album/1.jpg',
name: "大耳朵",
time: "2023.12.03 10:30",
status: 0
}, {
image: 'https://cdn.uviewui.com/uview/album/1.jpg',
name: "葉玲",
time: "2023.12.03 10:30",
status: 1 // 1已審核 0未審核
}]
},③css中樣式展示
container{
padding: 32rpx;
background-color: #fff;
border-radius: 16rpx;
}
.overbold {
font-weight: bold;
color: #1A1A1A;
font-family: PingFang SC-Bold;
line-height: 48rpx;
font-size: 32rpx;
}
.img-box {
position: relative;
.figure {
width: 80rpx;
height: 80rpx;
border-radius: 8rpx;
}
//中間的間隔線
.line {
position: absolute;
left: 50%;
top: 130%;
transform: translate(-50%, -50%);
width: 6rpx;
height: 60rpx;
background-color: rgba(102, 102, 102, 0.5);
}
}三、效果展示

以上就是實現(xiàn)審批流程的具體操作。
到此這篇關(guān)于uniapp實現(xiàn)-審批流程效果的文章就介紹到這了,更多相關(guān)uniapp審批流程內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
JavaScript轉(zhuǎn)換與解析JSON方法實例詳解
這篇文章主要介紹了JavaScript轉(zhuǎn)換與解析JSON方法,實例分析了JavaScript解析json的技巧,并附帶分析了jQuery解析與轉(zhuǎn)換json的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-11-11
詳細(xì)分析Javascript中創(chuàng)建對象的四種方式
這篇文章詳細(xì)介紹了Javascript中創(chuàng)建對象的幾種方式與每種方式的優(yōu)缺點,其中包括工廠模式、構(gòu)造函數(shù)模式、原型模式和組合使用構(gòu)造函數(shù)模式和原型模式,有需要的小伙伴們一起來學(xué)習(xí)學(xué)習(xí)吧。2016-08-08
JavaScript使用prototype屬性實現(xiàn)繼承操作示例
這篇文章主要介紹了JavaScript使用prototype屬性實現(xiàn)繼承操作,結(jié)合實例形式詳細(xì)分析了JavaScript使用prototype屬性實現(xiàn)繼承的相關(guān)原理、實現(xiàn)方法與操作注意事項,需要的朋友可以參考下2020-05-05
一個超簡單的JS拖拽實現(xiàn)代碼(兼容IE,Firefox)
網(wǎng)上找的一個超簡單的JS拖拽,喜歡拖拽效果的朋友可以參考下。2010-04-04
第一次接觸神奇的Bootstrap網(wǎng)格系統(tǒng)
第一次接觸神奇的Bootstrap網(wǎng)格系統(tǒng),Bootstrap讓W(xué)eb開發(fā)更迅速、更簡單,感興趣的小伙伴們可以參考一下2016-07-07

