You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
674 B

Page({
data:{
shopList:[]
},
dataList:{
page:1,//当前页面
pageSize:10,//请求数据的总量
total:0 //总数据量
},
//小程序生命周期函数,页面加载时调用
onLoad(){
},
getShopList(){
//发起网络请求
wx.request({
url: 'http://127.0.0.1:3:3000/data',
method:'GET',
data:{
page:this.dataList.Page,
pageSize:this.dataList.pageSize
},
//发送成功
success:res=>{
//打印返回的对象到调控台
console.log(res)
this.setData({
shopList:[...this.data.shopList,...res.data]//拼接
})
},
})
},
//上拉触底事件
onReachBottom(){
++this.dataList.Page
},
})