我在微信小程序中自定义两个函数,一个是获取位置,一个是获取天气,
在Page中
Page({
getLocalCity: function(){},
getWeather: function(){},
})
这样定义函数的,
调用时这样的:
Page({
onLoad:function(){
this.getLocalCity();
this.getWeather();
}
})
在onLoad的时候调用,但我无论怎么写,getWeather()函数都是执行在前,这是为什么呢?
说明:
getWeather用了wx.request() API,getLocalCity是用wx.getLoaction(),紧接着用高德的小程序SDK。
求知道指导一下~
return 一个 Promise 然后链式调用。