Home Reference Source Repository

src/components/tabbar/TabbarLabel.js

  1. /**
  2. * @author haw
  3. * 标签栏
  4. */
  5.  
  6. import React, {
  7. PropTypes
  8. } from 'react';
  9. import {classNames} from '../util';
  10.  
  11. const prefix = 'tabbar-label';
  12.  
  13. /**
  14. * 标签项文案
  15. * @param {Object} props 组件所使用的属性
  16. * @param {string} [props.label] 标签项的文案
  17. */
  18. export default function TabBarLabel(props) {
  19. const {
  20. label,
  21. className,
  22. children,
  23. ...rest
  24. } = props;
  25. let clazz = classNames(prefix, {
  26. [className]: className
  27. });
  28.  
  29. return (
  30. <div className={clazz} {...rest}>{children || label}</div>
  31. );
  32. }
  33.  
  34. TabBarLabel.propTypes = {
  35. label: PropTypes.string,
  36. className: PropTypes.string,
  37. children: PropTypes.node
  38. };