数据列表分页

2020-08-28  本文已影响0人  琳媚儿
  data() {
            return {
                page: 1, //分页默认为第一页
                last_page: '' //最后一页
            }
        },
methods:{
      
            getApiUserPortalEmsStaffPurseRecordGetListByCon() {
                this.$api.userPortal_emsStaffPurseRecord_getListByCon({
                    page: this.page,
                    page_size: 6, //分页数量,默认给个6
                }).then(res => {
                    // this.recordList = res.data.data.data 
                    this.recordList.push.apply(this.recordList, res.data.data.data);
                    this.last_page = res.data.data.last_page
                    console.log("根据条件获取ems_staff_purse_record列表", res)
                })
            },
  }

        //下拉刷新
        onPullDownRefresh() {
            this.page = 1;
            this.recordList = [];
            this.getApiUserPortalEmsStaffPurseRecordGetListByCon()
            uni.stopPullDownRefresh()
        },
        // 上拉加载
        onReachBottom() {
            if (this.last_page == this.page) {
                wx.showToast({
                    title: '已展示全部商品',
                    icon: 'none',
                    duration: 2000
                })
                return false;
            }
            this.page += 1;
            this.getApiUserPortalEmsStaffPurseRecordGetListByCon()
        },
上一篇 下一篇

猜你喜欢

热点阅读