diff --git a/docs/docs/index.md b/docs/docs/index.md index 4ee44de..80095b3 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -106,9 +106,12 @@ LngLat 文本编辑器,可以通过输入 LngLat 数据实现数据展示(目 customTiles: [ { id: 'GaodeSatellite', - image: 'https://mdn.alipayobjects.com/huamei_k6sfo0/afts/img/A*zi2jSqqZ2-8AAAAAAAAAAAAADjWqAQ/original', + image: + 'https://mdn.alipayobjects.com/huamei_k6sfo0/afts/img/A*zi2jSqqZ2-8AAAAAAAAAAAAADjWqAQ/original', title: '高德卫星底图', - layers: [' https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}'], + layers: [ + 'https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}', + ], }, ]; } diff --git a/src/components/map-control-group/official-layer-control/index.tsx b/src/components/map-control-group/official-layer-control/index.tsx index cc28cbc..c858a34 100644 --- a/src/components/map-control-group/official-layer-control/index.tsx +++ b/src/components/map-control-group/official-layer-control/index.tsx @@ -20,7 +20,7 @@ import { OfficeLayerEnum, } from '../../../constants'; import { useGlobal } from '../../../recoil'; -import type { CustomTilesProps } from '../../../types/l7editor'; +import type { CustomTiles } from '../../../types/l7editor'; import useStyle from './styles'; const layout = { @@ -92,7 +92,7 @@ export function OfficialLayerControl() { return false; // 阻止antd组件自动上传 }; - const onItemClick = (item: CustomTilesProps) => { + const onItemClick = (item: CustomTiles) => { setRadioValue(item.id); setLayerType( item.id === OfficeLayerEnum.VectorMap ? [] : ([item.id] as string[]), @@ -138,7 +138,7 @@ export function OfficialLayerControl() { const onConfirm = ( e: React.MouseEvent | undefined, - item: CustomTilesProps, + item: CustomTiles, ) => { e?.stopPropagation(); const newCustomTiles = customTiles.filter((val) => { diff --git a/src/recoil/atomState.ts b/src/recoil/atomState.ts index b75ccef..c97b040 100644 --- a/src/recoil/atomState.ts +++ b/src/recoil/atomState.ts @@ -5,7 +5,7 @@ import { atom, DefaultValue } from 'recoil'; import { LocalStorageKey } from '../constants'; import type { IFeatures, LngLatImportType } from '../types'; import type { FilterNode } from '../types/filter'; -import type { CustomTilesProps } from '../types/l7editor'; +import type { CustomTiles } from '../types/l7editor'; const localStorageEffect = (key: string) => @@ -173,7 +173,7 @@ const textLayerFieldsState = atom({ effects: [localStorageEffect(LocalStorageKey.textLayerFields)], }); -const customTilesState = atom({ +const customTilesState = atom({ key: 'customTiles', default: [], effects: [localStorageEffect(LocalStorageKey.customTiles)], diff --git a/src/types/l7editor.ts b/src/types/l7editor.ts index a9574b7..0dc1719 100644 --- a/src/types/l7editor.ts +++ b/src/types/l7editor.ts @@ -2,7 +2,7 @@ import type { LarkMapProps } from '@antv/larkmap'; import type { Feature } from '@turf/turf'; import type { TabsProps } from 'antd'; -export interface CustomTilesProps { +export interface CustomTiles { [key: string]: any; id: string; image: string; @@ -158,5 +158,5 @@ export interface L7EditorProps { /** * 自定义瓦片底图图层 */ - customTiles?: CustomTilesProps[]; + customTiles?: CustomTiles[]; }