优化全局下拉刷新
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
</view>
|
||||
|
||||
<!-- 访客列表 -->
|
||||
<scroll-view class="list-container" scroll-y>
|
||||
<view class="list-container">
|
||||
<view
|
||||
class="visitor-item"
|
||||
v-for="(item, index) in filterdList"
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<!-- 底部占位,防止最后一项贴底 -->
|
||||
<view class="list-bottom-space"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 新增邀请按钮 -->
|
||||
<view class="add-btn-wrapper">
|
||||
@@ -92,7 +92,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import { onShow, onPullDownRefresh } from "@dcloudio/uni-app";
|
||||
import { getVisitorList } from "../api/api.js";
|
||||
|
||||
const activeTab = ref("waiting");
|
||||
@@ -124,12 +124,18 @@ const fetchVisitorList = async () => {
|
||||
visitorList.value = mapData(res.data || []);
|
||||
} catch (err) {
|
||||
uni.showToast({ title: err.msg, icon: "none" });
|
||||
} finally {
|
||||
uni.stopPullDownRefresh();
|
||||
}
|
||||
};
|
||||
|
||||
onShow(() => {
|
||||
fetchVisitorList();
|
||||
})
|
||||
});
|
||||
|
||||
onPullDownRefresh(() => {
|
||||
fetchVisitorList();
|
||||
});
|
||||
|
||||
const filterdList = computed(() => {
|
||||
return visitorList.value.filter((item) => item.status === activeTab.value);
|
||||
@@ -149,10 +155,7 @@ const addInvitation = () => {
|
||||
<style scoped>
|
||||
/* 页面根容器 */
|
||||
.visitor-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
background: linear-gradient(135deg, #e2f0ff 0%, #f9f9f9 50%);
|
||||
padding: 0 30rpx;
|
||||
@@ -160,7 +163,11 @@ const addInvitation = () => {
|
||||
|
||||
/* 标签切换栏 */
|
||||
.tab-bar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
background: #e2f0ff;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
@@ -190,9 +197,6 @@ const addInvitation = () => {
|
||||
|
||||
/* 列表区域 */
|
||||
.list-container {
|
||||
flex: 1;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 访客卡片 */
|
||||
@@ -332,10 +336,3 @@ const addInvitation = () => {
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* 页面容器撑满并禁止整体滚动,让内部 scroll-view 单独滚动 */
|
||||
page {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user