<template> <view class="ayuu"> <view class=""> <view class="fzctob sclixmy" v-for="(item,index) in list" :key="index" @click="todetail(item.id)"> <view class="sckjert"> <image :src="item.img" mode="" style="width: 100%; height: 100%;border-radius: 10upx;"></image> </view> <view class="fsxto" style="width: 100%;margin-left: 24rpx;"> <view class="sctxtyuu"><text>{{item.title}}</text></view> <view class="sctxtyuua"><text>{{item.l_title}}</text></view> <view class="fzctob"> <text class="wdjga">¥</text> <text class="wdjgb">{{item.price}}</text> <text class="scjga">原价¥{{item.line_price}}</text> </view> </view> </view> </view> </view> </template> <style> page { background: #FAFAFA; } </style> <script> export default { data() { return { page: 1, num: 20, total: 0, list: [], user_id: '' } }, onReachBottom() { if (this.list.length < this.total) { this.page = this.page + 1 this.getlist(); } else { uni.showToast({ title: '没有更多数据了', icon: 'none' }) } }, onLoad() { this.user_id = uni.getStorageSync('id') this.getlist(); }, methods: { getlist() { let that = this; this.$post({ data: { do: 'MyCollection', data: { type: '2', page: that.page, num: that.num, user_id: that.user_id, pw: '375' } } }).then(res => { that.list = [...that.list, ...res.data.data] that.total = Number(res.data.total) }) }, todetail(id){ uni.navigateTo({ url:'/pages/index/kcxq-x?id='+id }) } } } </script> <style lang="scss" scoped> </style>