Skip to content
Snippets Groups Projects
Commit 8f244c68 authored by yms's avatar yms
Browse files

feat: 更新

parent 79a6bba4
Branches
Tags
No related merge requests found
import Tabs from '@/components/Tabs';
import { useState } from 'react';
import React, { useMemo, useState } from 'react';
import DistrictMap from './DistrictMap';
import EmphasisAreaMap from './EmphasisAreaMap';
import styles from './index.less';
const Map: Record<string, React.FC> = {
'1': DistrictMap,
'2': EmphasisAreaMap,
};
const MapContainer = () => {
const [topKey, setTopKey] = useState('1');
const botItems = [
......@@ -25,10 +30,10 @@ const MapContainer = () => {
},
];
const Map: Record<string, JSX.Element> = {
'1': <DistrictMap />,
'2': <EmphasisAreaMap />,
};
const renderMap = useMemo(() => {
const MapComponent = Map[topKey];
return <MapComponent />;
}, [topKey]);
return (
<div className={styles.container}>
......@@ -44,7 +49,7 @@ const MapContainer = () => {
}}
/>
</div>
<div className={styles.mapContent}>{Map[topKey]}</div>
<div className={styles.mapContent}>{renderMap}</div>
<div className={styles.botTabWarp}>
<div>
{botItems?.map((item) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment