antd popover组件二次封装子元素children显示
import React, { PropsWithChildren } from 'react'; import './index.scss'; import { Popover } from 'antd'; export interface DictPopoverCompProps { open: boolean; keyWords: string; } // 词库联想气泡 const DictPopoverComp = (props: PropsWithChildren<DictPopoverCompProps>) => { const { open, children } = props; const onOpenChangeFn = () => {}; return ( <Popover className="DictPopoverComp" content={<div>111</div>} open={open} onOpenChange={onOpenChangeFn} > {children} </Popover> ); }; export default DictPopoverComp;