import React, { useMemo } from 'react'; import Icon from '../Icon/index'; import { Dropdown, Menu } from 'antd'; function LargeScreenComponentFiltr(props: ILargeScreenComponentFiltr) { const { filterList = [], list = [], showAll = '', change, styles, menuList, value } = props; const clickFilter = (value, type) => { change?.(value, type); }; const menu = () => { return ( { clickFilter(key, 'menuClick'); }} /> ); }; const Dom = useMemo(() => { return (
{list?.length > 0 && list?.map((item, index) => { if (item === 'filter') { return ( {value} ); } else if (item === 'collapse') { return ( { clickFilter(showAll, 'collapse'); }} > {showAll} ); } })}
); }, [filterList, list, showAll, styles, value]); return Dom; } export default LargeScreenComponentFiltr; export interface ILargeScreenComponentFiltr { filterList?: IFilterList[]; list?: string[]; showAll?: string; change?: Function; styles?: React.CSSProperties; menuList?: IMenuList[]; value?: string; } export interface IMenuList { label: string; key: string; } export interface IFilterList { type?: string; selected?: string[]; options?: string[]; }