You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<template> <view class="content"> <view class="padding"> <notice :list="noticeList"/> <view style="padding-bottom: 20rpx;" v-if="noticeList.length>0"> <u-loadmore :status="status" /> </view> <nodata v-if="!noticeList.length&&status=='nomore'">暂无投票信息~</nodata> </view> </view> </template>
<script setup> import notice from '@/pages/tabbar/index/comp/notice.vue' import { getNoticeList, } from '@/config/api.js' import { onLoad, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app' import { ref } from 'vue' let status = ref('loading') let params = ref({ "pageNo": 1, "pageSize": 30, }) let noticeList = ref([]) const total = ref(0) async function getNoticeListFn() { const {data: res} = await getNoticeList(params.value) noticeList.value.push(...res.list) total.value = res.total if(noticeList.value.length>=total.value) status.value = 'nomore' console.log(res) } getNoticeListFn() async function initList () { params.value.pageNo = 1 noticeList.value = [] await getNoticeListFn() } onPullDownRefresh(async()=>{ await initList() uni.stopPullDownRefresh() }) onReachBottom(()=>{ if(total.value > noticeList.value.length) { getNoticeListFn() } }) </script>
<style lang="scss" scoped> .content { padding-bottom: 80rpx; } </style>
|