Skip to content

Commit

Permalink
fix: 修改ts类型
Browse files Browse the repository at this point in the history
  • Loading branch information
syb01094648 committed Mar 7, 2024
1 parent 3d49292 commit 03acf52
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
OfficeLayerEnum,
} from '../../../constants';
import { useGlobal } from '../../../recoil';
import type { CustomTilesProps } from '../../../types/l7editor';
import useStyle from './styles';

const layout = {
Expand All @@ -31,13 +32,6 @@ const enLayout = {
wrapperCol: { span: 15 },
};

type CustomTilesItemProps = {
id: string;
image?: string;
title?: string;
layers?: string[];
};

export function OfficialLayerControl() {
const [form] = Form.useForm();
const styles = useStyle();
Expand Down Expand Up @@ -98,7 +92,7 @@ export function OfficialLayerControl() {
return false; // 阻止antd组件自动上传
};

const onItemClick = (item: CustomTilesItemProps) => {
const onItemClick = (item: CustomTilesProps) => {
setRadioValue(item.id);
setLayerType(
item.id === OfficeLayerEnum.VectorMap ? [] : ([item.id] as string[]),
Expand Down Expand Up @@ -144,7 +138,7 @@ export function OfficialLayerControl() {

const onConfirm = (
e: React.MouseEvent<HTMLElement> | undefined,
item: CustomTilesItemProps,
item: CustomTilesProps,
) => {
e?.stopPropagation();
const newCustomTiles = customTiles.filter((val) => {
Expand Down
2 changes: 1 addition & 1 deletion src/recoil/atomState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const textLayerFieldsState = atom<string[] | undefined>({
effects: [localStorageEffect(LocalStorageKey.textLayerFields)],
});

const customTilesState = atom<CustomTilesProps>({
const customTilesState = atom<CustomTilesProps[]>({
key: 'customTiles',
default: [],
effects: [localStorageEffect(LocalStorageKey.customTiles)],
Expand Down
6 changes: 3 additions & 3 deletions src/types/l7editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import type { LarkMapProps } from '@antv/larkmap';
import type { Feature } from '@turf/turf';
import type { TabsProps } from 'antd';

export type CustomTilesProps = {
export interface CustomTilesProps {
[key: string]: any;
id: string;
image: string;
title: string;
layers: string[];
}[];
}

export interface MapControlProps {
logoControl?: boolean;
Expand Down Expand Up @@ -158,5 +158,5 @@ export interface L7EditorProps {
/**
* 自定义瓦片底图图层
*/
customTiles?: CustomTilesProps;
customTiles?: CustomTilesProps[];
}

0 comments on commit 03acf52

Please sign in to comment.