http.js
import utils from "../../utils/utils"
var http = utils.http;
const douban = "https://douban.uieee.com/v2/movie/";
onLoad:function(options){
var self = this;
var count = "?start=0&count=3";
var inTheaters = douban+"in_theaters"+ count;
var comingSoon = douban + "coming_soon" + count;
var top250 = douban + "top250" + count;
http(inTheaters, this.handleData,"in_theaters")
http(comingSoon, this.handleData,"coming_soon")
http(top250,this.handleData,"top250")
},
utils
function http(url,callback,type){
wx.request({
url,
header:{
'Content-type':'json'
},
success:function(res){
callback(res,type)
}
});
}
若本號內容有做得不到位的地方(比如:涉及版權或其他問題),請及時聯繫我們進行整改即可,會在第一時間進行處理。
請點贊!因爲你們的贊同/鼓勵是我寫作的最大動力!
歡迎關注達叔小生的簡書!
這是一個有質量,有態度的博客
[外鏈圖片轉存失敗(img-vQOChbBt-1566606701757)(https://upload-images.jianshu.io/upload_images/11158618-9ab0d3fef85d80ce?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)]