注意:使用promise回调函数
var that = this;
?new Promise((resolve, reject) => {
??console.log(‘进入Promise方法了‘);
??request({
???method: ‘GET‘,
???url: wx_gettoken_url
??}, function(err, res, body) {
???if (res) {
????resolve({
?????isSuccess: true,
?????data: JSON.parse(body)
????});
???} else {
????console.log (err);
????reject({
?????isSuccess: false,
?????data: err
????});
???}
??})
?}).then(proData => {
??that.getQrcode(proData);
?});
node中js页面发送request请求
原文地址:https://www.cnblogs.com/pyj63/p/8323724.html