分页下拉新增数据

This commit is contained in:
WindowBird 2025-11-17 14:06:09 +08:00
parent 2fe44259ae
commit a6fcf0a629

View File

@ -102,11 +102,7 @@
</view>
<!-- 项目列表 -->
<scroll-view
class="project-scroll"
scroll-y
@scrolltolower="handleScrollToLower"
>
<view class="project-scroll">
<view class="project-container">
<view
class="project-card"
@ -197,13 +193,13 @@
<text class="load-more-text">没有更多数据了</text>
</view>
</view>
</scroll-view>
</view>
</view>
</template>
<script setup>
import { ref, computed, watch, onMounted, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
import { getProjectList, getUserList } from '@/api';
import { usePagination } from '@/composables';
import { useDictStore } from '@/store/dict';
@ -513,8 +509,8 @@ const handleMemberChange = (e) => {
//
const handleSearch = () => {
reset();
getList();
// 使 updateParams
updateParams({});
};
//
@ -528,15 +524,27 @@ const handleReset = () => {
};
selectedMemberName.value = '';
activeStatusTab.value = 'IN_PROGRESS';
handleSearch();
// 使 updateParams
updateParams({});
};
//
const handleScrollToLower = () => {
// - 使 uniapp onReachBottom
onReachBottom(() => {
if (!noMore.value && !loading.value) {
loadMore();
}
};
});
// - 使 uniapp onPullDownRefresh
onPullDownRefresh(async () => {
try {
//
await refresh();
} finally {
//
uni.stopPullDownRefresh();
}
});
//
const goToProjectDetail = (project) => {
@ -581,7 +589,8 @@ onMounted(() => {
onLoad(() => {
nextTick(() => {
isInitialized.value = true;
handleSearch();
// getList使 reset=true
getList(true);
});
});
</script>