<view class="container" style="padding: 30rpx;">
<view style="margin:0rpx 20rpx;background-color: #f8f8f8;border-radius: 20rpx;padding:30rpx;" v-for="(item, index) in allInformation" :key="index">
<u-row>
<u-col span="6">
<view style="font-size: 36rpx; font-weight: bold;color: #626D71;">{{ item.roomNum }}</view>
</u-col>
<u-col span="6">
<u-row custom-style="justify-content:flex-end;font-size:28rpx">
<view class=" icon iconfont icon-kongxian"></view>
<view>未使用</view>
</u-row>
</u-col>
</u-row>
<view style="border-left:4px #8DD883 solid;margin-top:20rpx;font-size: 28rpx;">
<view class="" style="padding: 4rpx;">账号:{{ item.user }}</view>
<view style="padding: 4rpx;">密码:{{ item.password }}</view>
</view>
<view style="font-size: 24rpx;text-align: center;padding: 4rpx;">点击复制</view>
</view>
</view>
<script>
export default {
data() {
return {
allInformation: [], // 账号密码所有信息
list: 20, // 每次加载20条
page: 0 // 页数
};
},
onLoad() {
this.getNetAccount();
},
onReachBottom() {
// 如果已经加载完所有数据,则不再加载
if (this.page >= Math.ceil(this.allInformation.length / this.list)) {
return 1;
}
// 加载下一页数据
this.getNetAccount();
console.log(this.page,this.list);
},
methods: {
getNetAccount() {
const db = wx.cloud.database();
const skip = this.page * this.list;
const limit = this.list;
db.collection('netaccount')
.skip(skip)
.limit(limit)
.get()
.then(res => {
const data = res.data;
this.allInformation.push(...data);
this.page = this.page + 1;
});
}
}
};
我这个逻辑时多少有点问题的,请问怎么解决,触底根本没反应