监听子控件的click事件,并调用e.stopPropagation()阻止click事件继续传递,可以成功让外层的折叠面板父控件就接收不到click事件
const renderHeader = (header: string, icon: React.ReactNode, canEdit: boolean, item?: any) => (
<div>
{icon}
<span style={{ marginLeft: 8, marginRight: 8 }}>{header}</span>
{canEdit && <span>
<img src={img_edit} style={{ width: 15, height: 15 }} onClick={(e) => { e.stopPropagation(); setEditVisibleValue('编辑') }} />
</span>}
</div>
);