阅读背景:

CSS实现单选按钮

来源:互联网 
import React from 'react' import PropTypes from 'prop-types' import CX from 'classnames' import _ from 'lodash' import './index.less' function RadioButton(props) { const { style, title, isChecked, onClick, } = props const wrapperStyle = _.assign({}, style) return ( <div className="checkbox-wrap" style={wrapperStyle} onClick={onClick} role="button" tabIndex={0} > <span className={CX({ checkbox: true, checked: isChecked === true, })} /> <span className="tip-text">{title}</span> </div> ) } RadioButton.propTypes = { style: PropTypes.object, title: PropTypes.string, isChecked: PropTypes.bool, onClick: PropTypes.func, } RadioButton.defaultProps = { style: {}, title: '', isChecked: false, onClick: _.noop, } export default RadioButton import React from 'react' import PropTypes from '



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: