import {
        lazy
    } from '@/common/lazyLoadMix.js'
getInfo() { //加载信息
                uni.$u.http.get(this.type ? '/api/customer/getHomeJobSeekerList' : '/api/customer/getHomeRecruitVList', {
                    params: {
                        customerId: this.user.id,
                        pageNo: this.pageNo,
                        pageSize: this.pageSize
                    }
                }).then(({
                    data: {
                        data: {
                            list,
                            count
                        }
                    }
                }) => {if (!list.length) return
                    this.list = 
                        list.map(val => ({
                            img: uni.$u.http.config.baseURL + val.customer.img,
                            name: val.name,
                            sex: val.sex,
                            age: val.age,
                            id: val.id
                        })) 
                        this.count = count
                })
            },

 

export let lazy = { //懒加载
    data() {
        return {
            pageNo: 1,
            pageSize: 10,
            count: 0
        }
    },
    onShow() {
        this.pageNo = 1
        this.pageSize = 10
        this.getInfo()
    },
    onReachBottom() {
        console.log('lazy');
        // this.getInfo()
        if (this.count <= this.pageNo * this.pageSize) return
        this.pageNo++
        this.getInfo()
    },
    methods: {
        clear(arr) {
            this.pageNo = 1
            this.pageSize = 10
            this[arr] = []
        }
    }
}

 

 posted on 2022-11-24 09:34  laremehpe  阅读(350)  评论(0编辑  收藏  举报