12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- list: [],
- page: 1,
- no_more: false,
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function () {
- this.getList();
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({list:[],page:1,no_more:false});
- this.getList();
- wx.stopPullDownRefresh();
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- this.getList();
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- return {
- title: "晋爱人才",
- path: "/pages/home/home/home",
- };
- },
- //列表
- getList() {
- var self = this;
- if (self.data.no_more) {
- return false;
- }
- app.post('rob/product/index',{
- page:self.data.page,
- },function(res){
- if (res.length < 10) {
- self.setData({no_more:true});
- }
- let list = self.data.list;
- list = list.concat(res);
- let page = self.data.page;
- page++;
- self.setData({list:list,page:page});
- });
- },
- //搜索
- bindSearch() {
- this.setData({list:[],page:1,no_more:false});
- this.getList();
- }
- })
|