Newer
Older
SpaceIntegration_front / src / api / map.ts
liyaguang on 1 Nov 2023 564 bytes feat(*): 细节部分完善
import axios from 'axios'
import useMapStore from '@/store/modules/map'
const mapStore = useMapStore()
// 根据地理信息获取经纬度
export function getLatlng(address: string) {
  // 例 address = 北京市
  return axios.get(`https://restapi.amap.com/v3/geocode/geo?address=${address}&key=${mapStore.key}`)
}
// 根据经纬度获取详细位置信息
export function getLocation(posotion: string) {
  // 例子 posotion = 116.3254,39.1458
  return axios.get(`https://restapi.amap.com/v3/place/around?location=${posotion}&key=${mapStore.key}&offset=1`)
}