
```js
import GMap from '@/utils/map/GMap'

GMap.then((AMap) => {
  let map = new AMap.Map('mapComp', {
    zoom: 13,
    center: [118.773319, 31.828123],
  });

  // 根据经纬度 反查详细地址
  const geocoder = new AMap.Geocoder()
  geocoder.getAddress([116.396574, 39.992706], function(status, result) {
    if (status === 'complete' && result.info === 'OK') {
      console.log('result', result);
    }
  })

  // 添加缩放工具
  const toolbar = new AMap.ToolBar();
  map.addControl(toolbar);

  // 搜索
  AMapUI.loadUI(['misc/PoiPicker'], function (PoiPicker) {

    const poiPicker = new PoiPicker({
      input: 'pickerInput'
    });

    poiPicker.on('poiPicked', ({ item }) => {

      let inp = document.getElementById('pickerInput');
      inp.value = item.name;

      const marker = new AMap.Marker({
        title: item.address
      });

      marker.setMap(map);
      marker.setPosition(item.location);
      map.setCenter(marker.getPosition());

    })
  });

}).catch(e => console.log(e))


```