为什么高德地图的AMap.DistrictSearch中的search方法没有执行

img


在控制台输出console.log(status) 但是这段代码并没有输出

img


猜测是没有执行districtSearch.search这个函数。但是console.log(districtSearch.search)又发现有这个方法。求解答

解决了
https://lbs.amap.com/api/jsapi-v2/guide/abc/prepare
需要配置安全密钥,只有key的话不行。

img

解决了吗 我也遇到这个问题

这个问题我也遇到了求解

同问

同问!

求解

解决 了吗

建议直接用datav中的数据吧,高德就是不触发
datav 地址http://datav.aliyun.com/portal/school/atlas/area_selector

axios
        .get("https://geo.datav.aliyun.com/areas_v3/bound/110000.json")
        .then((res) => {
          console.log(res);
          var outer = [
            new AMap.LngLat(-360, 90, true),
            new AMap.LngLat(-360, -90, true),
            new AMap.LngLat(360, -90, true),
            new AMap.LngLat(360, 90, true),
          ];
          var holes = res.data.features[0].geometry.coordinates[0];

          var pathArray = [outer];
          pathArray.push.apply(pathArray, holes);
          var polygon = new AMap.Polygon({
            pathL: pathArray,
            strokeColor: "#00eeff",
            strokeWeight: 1,
            fillColor: "#71B3ff",
            fillOpacity: 0.5,
          });
          polygon.setPath(pathArray);
          map.add(polygon);
        });

同样遇到这个问题!!!

解决了吗