"path": "pages/index/index",
"style": {
"navigationBarTitleText": "notebook",
"enablePullDownRefresh": true
}
需要先将这个功能给开启
//开启下拉刷新
onPullDownRefresh(){
console.log("下拉刷新了……");
this.refresh=this.refresh+20
console.log(this.refresh);
uniCloud.callFunction({
name:"refresh_data",
data:{
num:this.refresh
}
}).then(res=>{
console.log(res);
this.listarr = res.result.data
console.log(this.listarr);
//将数据进行重新排列,按照正序
this.listarr.sort((a, b) => {
return a._id.localeCompare(b._id);
});
// 数据存储到本地
uni.setStorageSync('note', this.listarr);
this.note = this.listarr
})
uni.stopPullDownRefresh()//暂停下拉刷新
this.refreshvalue=false//用于控制刷新之后的位置
},
onPullDownRefresh()与onload()同级