app.js的onLaunch方法中使用Promise then方法,但却没有实现同步,请问目前微信小程序是不支持此方法吗?
问题是:访问pages/test/addsmall页面,程序首页执行app.js的onLaunch方法,里面有使用Promise then调用wx.request,但结果还没返回,就进入了pages/test/addsmall页面的onLoad方法
app.js部分代码:


addsmall.js方法:

控制台打印结果:

正常的结果应该是:先打印33,再打印~~~~~~~~~~
微信小程序开发者回答:
ん***:
Promise 仅能控制自身的 .then.then.catch... 流程,而不能保证位于 Promise 之后或之前的代码必须在 promise 执行完毕之后被调用。
晓***:系统记录
本文网址:http://www.91bianli.com/weixinxiaochengxu/27356.html