feat: 修复 l7-component 打包依赖报错问题 (#1413)

* refactor: 1.控件 LayerControl => LayerSwitch,防止在 LarkMap 中控件命名概念混淆  2.LayerSwitch 的参数 layers 新增支持传递 layer 的 id 数组

* fix: 修复 l7-component 打包依赖报错问题

Co-authored-by: yanxiong <oujinhui.ojh@antgroup.com>
This commit is contained in:
heiyexing 2022-10-20 12:43:01 +08:00 committed by GitHub
parent 5c1f29bbba
commit a94f12b60f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,4 @@
import { ILayer } from '@antv/l7-core';
import { BaseLayer } from '@antv/l7-layers';
import { createL7Icon } from '../utils/icon';
import SelectControl, {
ControlOptionItem,
@ -19,8 +18,8 @@ export default class LayerSwitch extends SelectControl<ILayerSwitchOption> {
if (Array.isArray(layers) && layers.length) {
const layerInstances: ILayer[] = [];
layers.forEach((layer) => {
if (layer instanceof BaseLayer) {
layerInstances.push(layer);
if (layer instanceof Object) {
layerInstances.push(layer as ILayer);
}
if (typeof layer === 'string') {
const targetLayer =