🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 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) } }); } ```