xlqx/app/config/amap.ts
2025-10-30 14:33:29 +08:00

34 lines
745 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 高德地图配置
export const amapConfig = {
// 高德地图Web服务API Key
// 在高德开放平台申请https://console.amap.com/dev/key/app
key: '11da89fddf9340d0a69d4fff53c0ec4b',
// 高德地图安全密钥Security Key
// 在高德开放平台的安全设置中获取用于保护API Key
// 地图默认配置
defaultCenter: [39.9042, 116.4074], // 北京坐标
defaultZoom: 13,
}
// 获取地图API URL
export const getAMapScriptUrl = () => {
return `https://webapi.amap.com/maps?v=2.0&key=${amapConfig.key}`
}
// 验证密钥配置
export const validateKeys = () => {
const hasKey = amapConfig.key && amapConfig.key !== 'YOUR_AMAP_KEY'
return {
hasKey,
isValid: hasKey
}
}