@Perfect-Demo
2018-03-17T12:46:47.000000Z
字数 621
阅读 822
微信小程序
onLoad: function() {that = this;wx.request( {url: "url",header: {"Content-Type": "application/x-www-form-urlencoded"},method: "POST",data: {},complete: function( res ) {console.log(res.data)});if( res == null || res.data == null ) {console.error( '网络请求失败' );return;}}})},
onLoad: function () {console.log('onLoad')var that = thiswx.request({url: 'http://json.bmbstack.com/cinemaList',data: {},method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECTheader: {'Accept': 'application/json'}, // 设置请求的 headersuccess: function(res){that.data.items= res.data},fail: function() {// fail},complete: function() {// complete}})}
参考脚本之家,侵删。