import { AMap, AMapType } from './@type/AMap'; import { LoadOption } from './@type'; import { MapOptions } from './@type/Map'; import { RenderMarkerCallbackParams } from './@type/MarkerCluster'; type PluginsType = 'AMap.MarkerCluster' | 'AMap.Weather' | 'AMap.AutoComplete' | 'AMap.Geocoder' | string export type LoaderOptions = { // key 高德地图key(缺省使用全局配置) key?: string // secret 高德地图secret(缺省使用全局配置) secret?: string // plugins 插件列表 plugins?: PluginsType[] // loadOption 加载选项 loadOption?: LoadOption } export type AMapClassProxy = T & { setAMap (AMap: AMap): void } // region useAMapHook type InfoOptions = ConstructorParameters[0] type MarkerClusterOptions = ConstructorParameters[2] type MapOptions = ConstructorParameters[1] export type UseAMapHookOptions = { // 是否自动加载地图(缺省值为true) autoLoad?: boolean // 加载选项 plugins?: PluginsType[] loaderOptions?: LoaderOptions // 地图 el: ShallowRef | string mapStyle?: string mapOpts?: MapOptions | (() => MapOptions) // 聚合标记 renderMarker? (e: RenderMarkerCallbackParams): void renderClusterMarker? (count: number, marker: AMap.Marker): void markerClusterOpts?: MarkerClusterOptions | (() => MarkerClusterOptions) // 信息窗体 infoWindowContent?: ShallowRef infoWindowOpts?: InfoOptions | (() => InfoOptions) } export type UseAMapHookExample = { init: () => Promise map: AMap.Map markerCluster: AMap.MarkerCluster infoWindow: AMap.InfoWindow AMap: AMap } // endregion