xiaoluoli

看代码

getImage(){
                this.$http.put(wechatapi+\'/token?access-token=\'+this.token).then((res)=> {

                    var postobj = {
                        \'type\':\'image\',
                        \'offset\':this.listnum2,
                        \'count\':this.perpage2
                    }
                    postobj = JSON.stringify(postobj)
                    this.$http.post(\'/cgi-bin/material/batchget_material?access_token=\'+res.body,postobj,{emulateJSON: true}).then((res)=>{
                        console.log(res,6666)
                        this.data2 = res.body.item;
                        this.listTotal2 = res.body[\'total_count\'];
                        this.page2 =  Math.ceil((res.body[\'total_count\'])/(this.perpage2));
                    }).catch((res)=>{})
                }).catch((error)=> {})
                
 },

分页需要根据自定义页数perpage2去请求,offset参数就是请求到哪一个位置,count是页数

分类:

技术点:

相关文章: