vue 微信公眾號獲取圖片素材接口


看代碼

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是頁數


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM