import * as Nerv from 'nervjs' import Component from '@lib/component' interface BadgeProps { value?: string | number maxNum?: number dot?: boolean show?: boolean status?: string } // interface BadgeState {} class Badge extends Component { static defaultProps = { value: '', maxNum: 99, dot: false, show: true, status: 'error' } constructor (...args) { super(...args) } render () { const { children, status, dot, show, value, maxNum } = this.props const content = () => { if (dot) { return } if (typeof value === 'number') { return value > Number(maxNum) ? `${maxNum}+` : value } return value } return ( {children} {content()} ) } } export default Badge