diff --git a/src/platforms/h5/helpers/location.js b/src/platforms/h5/helpers/location.js index ab61ef7ddc099b8a8c2cb3284d5b24a42aec0dcd..5c8476dd5ae5e54c19eebe6544df66cf77c112e8 100644 --- a/src/platforms/h5/helpers/location.js +++ b/src/platforms/h5/helpers/location.js @@ -6,21 +6,33 @@ export const ICON_PATH_TARGET = export const MapType = { QQ: 'qq', GOOGLE: 'google', + AMAP: 'AMap', UNKNOWN: '' } export function getMapInfo () { - let type = MapType.UNKNOWN - let key = '' if (__uniConfig.qqMapKey) { - type = MapType.QQ - key = __uniConfig.qqMapKey - } else if (__uniConfig.googleMapKey) { - type = MapType.GOOGLE - key = __uniConfig.googleMapKey + return { + type: MapType.QQ, + key: __uniConfig.qqMapKey + } + } + if (__uniConfig.googleMapKey) { + return { + type: MapType.GOOGLE, + key: __uniConfig.googleMapKey + } + } + if (__uniConfig.sdkConfigs.maps.AMap && __uniConfig.sdkConfigs.maps.AMap.key) { + return { + type: MapType.AMAP, + key: __uniConfig.sdkConfigs.maps.AMap.key, + securityJsCode: __uniConfig.sdkConfigs.maps.AMap.securityJsCode, + serviceHost: __uniConfig.sdkConfigs.maps.AMap.serviceHost + } } return { - type, - key + type: MapType.UNKNOWN, + key: '' } } diff --git a/src/platforms/h5/view/components/map/index.vue b/src/platforms/h5/view/components/map/index.vue index 6cb7368c64850d318cc3d293e64901d28cc2d67a..0a111eff9ef6810060bb3d7cdbd8dbaaca2dba34 100644 --- a/src/platforms/h5/view/components/map/index.vue +++ b/src/platforms/h5/view/components/map/index.vue @@ -1,7 +1,9 @@