新增下拉刷新

This commit is contained in:
Zy
2026-08-20 09:29:12 +08:00
parent 42387c476d
commit ab868f8180
9 changed files with 97 additions and 445 deletions

View File

@@ -71,7 +71,7 @@ import navBar from '@/components/navbar/navbar.vue'
import { computed, ref } from 'vue'
import { getInspectionList } from '@/api/insepction.js'
import { parseTime } from '@/utils/time.js'
import { onShow } from '@dcloudio/uni-app'
import { onShow, onPullDownRefresh } from '@dcloudio/uni-app'
const isComputed = (status: string) => {
const awaitlist = ['未完成', '待执行', '执行中']
@@ -143,6 +143,10 @@ function getlist() {
})
})
.finally(() => {
if (isRefresh) {
uni.stopPullDownRefresh()
isRefresh = false
}
isLoading.value = false
})
}
@@ -188,10 +192,11 @@ function handleChangeTabs(val: number) {
getlist()
}
// ---------------------------------------------------------------------
onShow(() => {
hasMore.value = true
function init() {
resetList()
}
onShow(() => {
init()
})
function resetList() {
list.value = []
@@ -201,6 +206,13 @@ function resetList() {
getlist()
}
// 是否正在下拉刷新
let isRefresh = false
onPullDownRefresh(() => {
isRefresh = true
init()
})
// 返回上一页
const navBack = () => {
uni.navigateBack()