Skip to content

Commit

Permalink
feat: 地图类型新增对百度和腾讯地图的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
heiyexing committed Nov 6, 2023
1 parent 2c887b4 commit 2d10a50
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/components/LarkMap/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ export const createMap = async (mapType: LarkMapProps['mapType'], mapOptions: Pa
return new GaodeMapV2(mapOptions);
}

if (mapType === 'Tencent') {
return Promise.resolve(import('@antv/l7')).then(({ TencentMap }) => {
return new TencentMap(mapOptions);
});
}
if (mapType === 'Baidu') {
return Promise.resolve(import('@antv/l7')).then(({ BaiduMap }) => {
return new BaiduMap(mapOptions);
});
}

return Promise.resolve(import('@antv/l7')).then(({ Mapbox }) => {
return new Mapbox(mapOptions);
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/LarkMap/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ nav:

### 介绍

LarkMap 是地图容器组件,相关地图组件与 Hooks 需放到容器组件内部才能使用,容器组件可通过属性配置不同的地图,支持 [Mapbox](https://docs.mapbox.com/mapbox-gl-js/api/map/)[Gaode](https://lbs.amap.com/api/jsapi-v2/documentation#map)[L7Map](https://l7.antv.antgroup.com/api/map) 作为底图。
LarkMap 是地图容器组件,相关地图组件与 Hooks 需放到容器组件内部才能使用,容器组件可通过属性配置不同的地图,支持 [Mapbox](https://docs.mapbox.com/mapbox-gl-js/api/map/)[Gaode](https://lbs.amap.com/api/jsapi-v2/documentation#map)[Baidu](https://mapopen-pub-jsapi.bj.bcebos.com/jsapi/reference/jsapi_webgl_1_0.html#a0b0)[Tencent](https://lbs.qq.com/webApi/javascriptGL/glDoc/docIndexMap)[L7Map](https://l7.antv.antgroup.com/api/map) 作为底图,其中 [Baidu](https://mapopen-pub-jsapi.bj.bcebos.com/jsapi/reference/jsapi_webgl_1_0.html#a0b0)[Tencent](https://lbs.qq.com/webApi/javascriptGL/glDoc/docIndexMap) 仍为实验特性

### 代码演示

Expand All @@ -34,7 +34,7 @@ LarkMap 是地图容器组件,相关地图组件与 Hooks 需放到容器组
| style | 容器行内样式 | `CSSProperties` | -- |
| className | 容器类名 | `string` | -- |
| map | 地图实例,可选,也可以通过配置项自动生成实例,详见 [L7 map](https://l7.antv.antgroup.com/api/map/map) | `MapInstance | (() => Promise<IMapWrapper>)` | -- |
| mapType | 地图底图类型 | `'Gaode'|`<br />`'GaodeV2'|`<br />`'Mapbox'|`<br />`'Map'` | `'Gaode'` |
| mapType | 地图底图类型 | `'Gaode'|`<br />`'GaodeV2'|`<br />`'Mapbox'|`<br />`'Map'`<br />`'Tencent'|`<br />`'Baidu'` | `'Gaode'` |
| mapOptions | 地图配置项,配合地图类型配置地图,详情可见 [MapOptions](#mapoptions) | `MapOptions` | -- |
| logoPosition | logo 展示位置,配置项详见 [L7 logoPosition](https://l7.antv.antgroup.com/api/scene#logoposition) | `PositionName` | `'bottomleft'` |
| logoVisible | 是否显示 logo | `boolean` | `true` |
Expand Down
2 changes: 1 addition & 1 deletion src/components/LarkMap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface LarkMapProps extends CommonProps, Omit<ISceneConfig, 'id' | 'ca
* 地图类型
* @default 'Gaode'
*/
mapType?: 'Gaode' | 'GaodeV1' | 'GaodeV2' | 'Mapbox' | 'Map';
mapType?: 'Gaode' | 'GaodeV1' | 'GaodeV2' | 'Mapbox' | 'Map' | 'Tencent' | 'Baidu';
/**
* 地图配置项
* 配合地图类型配置地图,
Expand Down

0 comments on commit 2d10a50

Please sign in to comment.