优化全局下拉刷新
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<template>
|
||||
<view class="contentStyle">
|
||||
<view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<uni-nav-bar title="巡检记录" backgroundColor="transparent" :border="false" left-icon="left" @click-left="goBack" />
|
||||
<view class="content-wrap">
|
||||
<!-- 时间选择器 -->
|
||||
<view class="timebox">
|
||||
@@ -18,7 +16,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<!-- 巡检列表 -->
|
||||
<scroll-view scroll-y class="scroll-view">
|
||||
<view class="scroll-view">
|
||||
<view class="list-container" v-if="listData.length > 0">
|
||||
<view class="card-item" v-for="(item, index) in listData" :key="index" @click="goToInspectionDetail(item)">
|
||||
<view class="card-head">
|
||||
@@ -35,7 +33,7 @@
|
||||
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
|
||||
<text class="empty-text">暂无数据</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -111,14 +109,11 @@
|
||||
// ---------- 日期变更(使用 moment) ----------
|
||||
const handleChangeTime = (e) => {
|
||||
if (e) {
|
||||
// e 格式为 YYYY-MM-DD,用 moment 解析并格式化为 MM-DD
|
||||
showDate.value = moment(e).format('MM-DD')
|
||||
datetime.value = e
|
||||
} else {
|
||||
// 用户清空日期,可根据业务设置默认值或置空
|
||||
showDate.value = '选择日期'
|
||||
datetime.value = ''
|
||||
// 如果希望清空时不请求,可 return,否则也重置列表
|
||||
}
|
||||
// 重置分页并刷新
|
||||
pageNum.value = 1
|
||||
@@ -140,11 +135,6 @@
|
||||
fetchList(true)
|
||||
})
|
||||
|
||||
// ---------- 返回 ----------
|
||||
const goBack = () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
|
||||
// ---------- 页面返回拦截 ----------
|
||||
onBackPress(() => {
|
||||
const pages = getCurrentPages()
|
||||
@@ -165,9 +155,9 @@
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.contentStyle {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(to left bottom, #e2efff 0%, #f9f9f9 50%);
|
||||
}
|
||||
|
||||
@@ -180,11 +170,6 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
width: 100%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.timebox {
|
||||
width: 188rpx;
|
||||
height: 48rpx;
|
||||
@@ -249,10 +234,10 @@
|
||||
}
|
||||
}
|
||||
//滚动容器 App重点:高度自适应 \*/
|
||||
.scroll-view {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
}
|
||||
// .scroll-view {
|
||||
// flex: 1;
|
||||
// height: 0;
|
||||
// }
|
||||
.list-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user