美文网首页
高德地图jsApi输入地址查询经纬度方法

高德地图jsApi输入地址查询经纬度方法

作者: 风中凌乱的男子 | 来源:发表于2020-12-10 17:28 被阅读0次
geoCode() {
      var geocoder = new AMap.Geocoder({
        city: "",
      });
      var address = this.form.address;
      geocoder.getLocation(address, function(status, result) {
        if (status === 'complete' && result.geocodes.length) {
          var lnglat = result.geocodes[0].location
          console.log(lnglat);
        } else {
          console.log('根据地址查询位置失败');
        }
      });
    }

相关文章

网友评论

      本文标题:高德地图jsApi输入地址查询经纬度方法

      本文链接:https://www.haomeiwen.com/subject/lisrgktx.html