首先在配置页面index.json 添加以下代码
"enablePullDownRefresh": true,"backgroundTextStyle": "dark"
然后在index.jx页面配置下拉刷新
onPullDownRefresh: function () {
db.collection("云数据库表名").orderBy('value','asc'(此代码是降序代码可有可无)).get().then(res => {
console.log(res)
this.setData({
变量名可自定义: res.data,})
})
wx.showToast({
title: '刷新成功',})
wx.stopPullDownRefresh({
success: (res) => {
},})
},