diff --git a/src/components/LarkMap/helper.ts b/src/components/LarkMap/helper.ts index 5739ac75..58fbf533 100644 --- a/src/components/LarkMap/helper.ts +++ b/src/components/LarkMap/helper.ts @@ -1,5 +1,5 @@ import type { IMapConfig } from '@antv/l7'; -import { GaodeMap, GaodeMapV1, GaodeMapV2, Map } from '@antv/l7'; +import { BaiduMap, GaodeMap, GaodeMapV1, GaodeMapV2, Map, TencentMap } from '@antv/l7'; import type { LarkMapProps } from './types'; export const createMap = async (mapType: LarkMapProps['mapType'], mapOptions: Partial) => { @@ -16,14 +16,11 @@ export const createMap = async (mapType: LarkMapProps['mapType'], mapOptions: Pa } if (mapType === 'Tencent') { - return Promise.resolve(import('@antv/l7')).then(({ TencentMap }) => { - return new TencentMap(mapOptions); - }); + return new TencentMap(mapOptions); } + if (mapType === 'Baidu') { - return Promise.resolve(import('@antv/l7')).then(({ BaiduMap }) => { - return new BaiduMap(mapOptions); - }); + return new BaiduMap(mapOptions); } return Promise.resolve(import('@antv/l7')).then(({ Mapbox }) => { diff --git a/src/components/Marker/index.tsx b/src/components/Marker/index.tsx index 5dee2a25..76e83512 100644 --- a/src/components/Marker/index.tsx +++ b/src/components/Marker/index.tsx @@ -3,7 +3,7 @@ import { useDeepCompareEffect } from 'ahooks'; import React, { memo, useEffect, useMemo, useRef } from 'react'; import { createPortal } from 'react-dom'; import { useScene } from '../LarkMap/hooks'; -import type { MarkerProps } from './types'; +import type { MarkerEventType, MarkerProps } from './types'; export const Marker = memo(function Marker(props): React.ReactPortal { const scene = useScene(); @@ -24,7 +24,7 @@ export const Marker = memo(function Marker(props): React.ReactPorta // @ts-ignore const l7marker = new L7Marker(options); - l7marker.on('click', (e: MouseEvent) => { + l7marker.on('click', (e: MarkerEventType) => { thisRef.current.props.onClick?.(e); });