current position:Home>Vue develops Gaode map, clicks the map to obtain the longitude and latitude, but fails to obtain the information with inverse geocoding, and returns invalid_ USER_ SCODE

Vue develops Gaode map, clicks the map to obtain the longitude and latitude, but fails to obtain the information with inverse geocoding, and returns invalid_ USER_ SCODE

2022-02-02 20:44:21 CSDN Q & A

//  Initialize map     init() {      AMapLoader.load({        key: "20e*****************fef3bcd2", //  Apply well Web End developers Key        version: "2.0", //  Specify the... To load  JSAPI  Version of         plugins: ["AMap.Geolocation", "AMap.Geocoder", "AMap.Marker"], //  List of plug-ins to use       })        .then((AMap) => {          this.map = new AMap.Map("map", {            zoom: 13, // Zoom ratio             center: [120.306376, 31.588048],            viewMode: "2D",            terrain: true, // Open topographic map             mapStyle: "amap://styles/dark",          });        })        .catch((e) => {          console.log(e, " Map loading failed ");        });    },// Click on the map     clickLocation() {      this.map.on("click", this.clickMap);    },    clickMap(e) {      let arr = [e.lnglat.lng, e.lnglat.lat];      console.log(arr);      if (this.mark) {        this.map.removeControl(this.mark);      }      this.mark = new AMap.Marker({        position: arr,      });      this.geocoder = new AMap.Geocoder({        city: " The national ",        radius: 500,        extensions: "all",      });      this.map.addControl(this.mark);      try {        this.geocoder.getAddress(arr, function (status, result) {          console.log(status, result);        });      } catch (error) {        console.log(error, " error ");      }    },



Refer to the answer 1:

This depends api Have to document What does it mean




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022044187387.html

Random recommended