const Component = ({ is, children, ...restProps }) => {
  const Tag = require("antd")[is];

  if (!Tag) return false;

  return <Tag {...restProps}>{children}</Tag>;
};

export default Component;

  

<Component
          is="Switch"
          checkedChildren="开启"
          unCheckedChildren="关闭"
          defaultChecked
          onClick={() => console.log(222)}
        >
          122
        </Component>

  

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
猜你喜欢
  • 2021-12-25
  • 2022-12-23
  • 2021-08-01
  • 2021-06-15
  • 2021-10-23
  • 2021-09-22
  • 2021-06-12
相关资源
相似解决方案