Detailed description of the applet wx. request (object) API and instance code, wx. requestapi
Here, we use the API of the concentration camp to request data. If you are prompted that the URL domain name is invalid, configure it in the mp background and modify the asdebug. js code again. See the following figure.
Go to the asdebug. js File
When you enable the search keyword URL domain name, the invalid keyword indicates that the error message is annotated with two lines of code.
Main Methods:
Wxml
<Block wx: for-items = "{result}"> <view style = "width: 100%; height: 50rpx" ></view> <! -- Index is a subscript by default, and item is each item --> <text> entry {index} of Data {item. desc }}</text> <text> address {item. url }}</text> </block>
Js
Page ({data: {// text: "this is a Page" result: []}, onLoad: function () {var that = this; wx. request ({url: 'http: // gank. io/api/data/Android/30/1 ', method: 'get', success: function (res) {that. setData ({result: res. data. results}) }}, listenerButton: function (){}})
Thank you for reading this article and hope to help you. Thank you for your support for this site!