diff --git a/docs/docs/index.md b/docs/docs/index.md index 060d923..4ee44de 100644 --- a/docs/docs/index.md +++ b/docs/docs/index.md @@ -105,10 +105,10 @@ LngLat 文本编辑器,可以通过输入 LngLat 数据实现数据展示(目 { customTiles: [ { - id: 'id', - image: 'img', - title: 'title', - layers: ['layerUrl'], + id: 'GaodeSatellite', + 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}'], }, ]; } diff --git a/src/recoil/atomState.ts b/src/recoil/atomState.ts index 0c983b1..fa20650 100644 --- a/src/recoil/atomState.ts +++ b/src/recoil/atomState.ts @@ -5,6 +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'; const localStorageEffect = (key: string) => @@ -172,15 +173,7 @@ const textLayerFieldsState = atom({ effects: [localStorageEffect(LocalStorageKey.textLayerFields)], }); -const customTilesState = atom< - { - [x: string]: any; - id: string; - image: string; - title: string; - layers: string[]; - }[] ->({ +const customTilesState = atom({ key: 'customTiles', default: [], effects: [localStorageEffect(LocalStorageKey.customTiles)], @@ -199,13 +192,11 @@ const wasmPathState = atom({ export { activeTabState, - showDrawAreaState, autoFitBoundsState, baseMapState, cityHistoryState, convertState, customTilesState, - showDrawDistanceState, editorTextState, featureState, filterState, @@ -221,6 +212,8 @@ export { rightWidthState, savedTextState, sceneState, + showDrawAreaState, + showDrawDistanceState, showTextLayerState, textLayerFieldsState, themeState, diff --git a/src/types/l7editor.ts b/src/types/l7editor.ts index 57a4728..f3789dc 100644 --- a/src/types/l7editor.ts +++ b/src/types/l7editor.ts @@ -2,6 +2,14 @@ import type { LarkMapProps } from '@antv/larkmap'; import type { Feature } from '@turf/turf'; import type { TabsProps } from 'antd'; +export type customTilesProps = { + [key: string]: any; + id: string; + image: string; + title: string; + layers: string[]; +}[]; + export interface MapControlProps { logoControl?: boolean; drawControl?: boolean; @@ -150,11 +158,5 @@ export interface L7EditorProps { /** * 自定义瓦片底图图层 */ - customTiles?: { - [x: string]: any; - id: string; - image: string; - title: string; - layers: string[]; - }[]; + customTiles?: customTilesProps; }