微信小程序使用高德SDK获取天气

 import amapFile from '@/libs/amap-wx.js'
 this.myAmapFun = new amapFile.AMapWX({
    
    key: 'your key'});
 this.myAmapFun.getWeather(
  {
    
    
         city:'地区行政编码',
         success: (data)=>{
    
    
             //成功回调
             console.log(data,'天气')
            
          },
          fail: function(info){
    
    
             //失败回调
             console.log(info)
          }
 })

猜你喜欢

转载自blog.csdn.net/qq_44540152/article/details/117816634