Skip to content

Commit

Permalink
fix: 修复 LayerSwitch 误识别 L7Plot 问题
Browse files Browse the repository at this point in the history
  • Loading branch information
heiyexing committed Nov 16, 2023
1 parent fad0dc9 commit 66c4231
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/component/src/control/layerSwitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ export interface ILayerSwitchOption extends ISelectControlOption {
export { LayerSwitch };

function isLayerSwitchItem(obj: any): obj is LayerSwitchItem {
return obj && obj.layer;
return Object.keys(obj ?? {}).every((key) =>
['layer', 'name', 'img'].includes(key),
);
}

export default class LayerSwitch extends SelectControl<ILayerSwitchOption> {
protected get layers(): ILayer[] {
const layerService = this.layerService;
Expand Down

0 comments on commit 66c4231

Please sign in to comment.