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="pageBgImg "> <topNavbar title="我的评价"></topNavbar> <view class="pad"> <view class="card" v-for="(item,index) in list" :key="index"> <commentItem :item="item"/> </view> <view class="card" v-if="!list.length"> <nodata>暂无评价</nodata> </view> </view> <view style="padding-bottom: 20rpx;" v-if="list.length>4"> <u-loadmore :status="status" /> </view> </view> </template>
<script> import { getUsersCommentById } from '@/config/api.js' import commentItem from './comp/commentItem.vue' export default { components: { commentItem }, data() { return { params: { userId: '', pageNo: 1,pageSize: 20 }, total: 20, status: 'loading', list: [] } }, onLoad() { this.getUsersCommentByIdFn() this.params.userId = this.userId }, onPullDownRefresh() { this.params.pageNo = 1 this.list = [] this.getUsersCommentByIdFn().then(()=>{ uni.stopPullDownRefresh() }) }, onReachBottom() { if(this.total>this.list.length) { this.getUsersCommentByIdFn() } }, methods: { async getUsersCommentByIdFn() { const {data: res} = await getUsersCommentById(this.params) this.params.pageNo ++ let arr = res.list.map(item=>{ if(item.images) { item.images = item.images.split(',') } return item }) this.list.push(...res.list) this.total = res.total if(this.list.length>=this.total) this.status = 'nomore' } } } </script>
<style lang="scss" scoped> .card { width: 100%; padding: 24rpx 28rpx; margin-bottom: 20rpx; } </style>
|