分页下拉新增数据

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