weather.js 484 B

1234567891011121314151617181920212223
  1. var amapFile = require('../../libs/amap-wx.js');
  2. var config = require('../../libs/config.js');
  3. Page({
  4. data: {
  5. weather: {}
  6. },
  7. onLoad: function() {
  8. var that = this;
  9. var key = config.Config.key;
  10. var myAmapFun = new amapFile.AMapWX({key: key});
  11. myAmapFun.getWeather({
  12. success: function(data){
  13. that.setData({
  14. weather: data
  15. });
  16. },
  17. fail: function(info){
  18. // wx.showModal({title:info.errMsg})
  19. }
  20. })
  21. }
  22. })