import React, { useState, useEffect } from 'react'; import mapstyles from '@/assets/css/map.less'; import { getMapList } from '@/services/ant-design-pro/environment'; import cx from 'classnames'; type MapProps = { //mapList: API.MapInfo[]; type: string; render: (item: API.MapInfo, index: number) => React.ReactNode; }; const Map: React.FC = ({ type, render }) => { const [mapList, setMapList] = useState([]); useEffect(() => { getMapList({ floorId: 'sffsdfdsfdf', floorNumber: 22 }).then(function (res) { var data: API.MapInfo[] = res.data || []; setMapList(data); }); }, []); return (
{mapList.map(function (item, index) { return render(item, index); })}
); }; export default Map;