通用分类分页加载器的完善

This commit is contained in:
WindowBird 2025-08-26 09:38:47 +08:00
parent de2ac5d37c
commit 482a7e174e
3 changed files with 9 additions and 0 deletions

View File

@ -81,6 +81,7 @@ export function usePagination(options = {}) {
// 检查是否还有更多数据
if (mode === 'loadMore') {
noMore.value = queryParams.value.pageNum * pageSize >= total
console.log(`noMore状态: ${noMore.value}, 当前页: ${queryParams.value.pageNum}, 每页: ${pageSize}, 总数: ${total}`)
}
console.log(`获取数据成功: 第${queryParams.value.pageNum}页,共${newData.length}`)

View File

@ -23,6 +23,7 @@ import { onMounted } from 'vue'
import { getArticleList } from '@/api/article/article.js'
import { onReachBottom } from '@dcloudio/uni-app'
import { usePagination } from '@/composables/usePagination.js'
import Pagination from '@/components/pagination/pagination.vue'
// 使
const { list, loading, noMore, pagination, getList, loadMore } = usePagination({
@ -45,6 +46,12 @@ onMounted(() => {
//
onReachBottom(() => {
console.log('触发上拉加载更多,当前状态:', {
loading: loading.value,
noMore: noMore.value,
listLength: list.value.length,
total: pagination.value.total
})
loadMore()
})

View File

@ -73,6 +73,7 @@ import { onMounted } from 'vue'
import { onReachBottom } from '@dcloudio/uni-app'
import { usePagination } from '@/composables/usePagination.js'
import { getMyOrder } from '@/api/order/myOrder.js'
import Pagination from '@/components/pagination/pagination.vue'
// 使
const { list, loading, noMore, pagination, getList, loadMore } = usePagination({