//云端代码 'use strict'; const db = uniCloud.database() exports.main = async (event, context) => { const collection = db.collection(event.name) const res = await collection.where(event.data).limit(event.limit).get() return res };
//前端代码 getskiplimit() { uni.showLoading({ title: '处理中...' }) uniCloud.callFunction({ name: 'getskiplimit', data:{ name:'unicloud-test', data:{ product:"uniCloud2" }, skip:1,//跳过指定数量的数据 limit:2//返回的结果集(文档数量) } }).then((res) => { uni.hideLoading() uni.showModal({ content: `查询成功,获取数据列表为:${JSON.stringify(res.result.data)}`, showCancel: false }) console.log(res) }).catch((err) => { uni.hideLoading() uni.showModal({ content: `查询失败,错误信息为:${err.message}`, showCancel: false }) console.error(err) }) },
标签:const,data,条数,getskiplimit,res,uni,跳过,event From: https://www.cnblogs.com/zzl00770/p/17990804