在框架用户设计中将“徽章”设置为“面板”

时间:2019-07-19 00:12:13

标签: javascript reactjs antd

是否可以将Badge中“信息”旁边的Panel设置为ant design

enter image description here

Code

<div>
  <Collapse>
    <Panel header="Info" key="1">
      <Badge
        count={4}
        style={{
          backgroundColor: "#fff",
          color: "#999",
          boxShadow: "0 0 0 1px #d9d9d9 inset"
        }}
      />
    </Panel>
  </Collapse>
</div>

1 个答案:

答案 0 :(得分:1)

是的,Collapse.Panel-header道具接受ReactNode,因此您可以使用antd Grid来渲染example所需的任何内容:

enter image description here

export default function App() {
  return (
    <Collapse>
      <Collapse.Panel
        header={
          <Row type="flex" gutter={10}>
            <Col>Info</Col>
            <Col>
              <Badge
                count={4}
                style={{
                  backgroundColor: '#fff',
                  color: '#999',
                  boxShadow: '0 0 0 1px #d9d9d9 inset'
                }}
              />
            </Col>
          </Row>
        }
        key="1"
      />
    </Collapse>
  );
}

Edit styled-antd-react-starter