已采納回答 / 謝成
你現在使用的API我不確定是否好用,但我推薦給你那個肯定是好用的,把http://api.douban.com/v2/movie/in_theaters?apikey=0df993c66c0c636e29ecbb5344252a4a&start=0&count=10?粘貼到瀏覽器里是有結果返回的,說明接口沒有問題,那問題應該就出現在代碼上。1、確定API確實改成了我給你的這個2、確定云函數上傳成功了3、在云控制臺中進行云端測試,看結果是否是正確的4、在小程序端輸出這個res,看結果是什么
2019-05-16
講師回答 / 謝成
那個API只能通過云函數請求。如果想在小程序端請求的話,試試這個:?https://m.douban.com/rexxar/api/v2/subject_collection/movie_showing/items?start=0&count=10
2019-05-16
老師,這里不能直接 this.setData({
movieList:this.movieList.concat(JSON.parse(res.result).subjects);});
需要設置變量,不然會報 Cannot read property 'concat' of undefined,我這樣改的:var dataList = this.movieList.concat(JSON.parse(res.result).subjects);
this.setData({
movieList: dataList
});
movieList:this.movieList.concat(JSON.parse(res.result).subjects);});
需要設置變量,不然會報 Cannot read property 'concat' of undefined,我這樣改的:var dataList = this.movieList.concat(JSON.parse(res.result).subjects);
this.setData({
movieList: dataList
});
已采納回答 / 謝成
在請求API的url后面跟一個apikey參數:http://api.douban.com/v2/movie/in_theaters?apikey=0df993c66c0c636e29ecbb5344252a4a&start=0&count=10
2019-05-16