dtd
Version:
根据数梦工场视觉规范打造的组件库,感谢react-components和ant design
1 lines • 1.07 kB
JavaScript
import _extends from"babel-runtime/helpers/extends";import _classCallCheck from"babel-runtime/helpers/classCallCheck";import _createClass from"babel-runtime/helpers/createClass";import _possibleConstructorReturn from"babel-runtime/helpers/possibleConstructorReturn";import _inherits from"babel-runtime/helpers/inherits";import*as React from"react";import*as PropTypes from"prop-types";import Radio from"./radio";var RadioButton=function(e){function t(){return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _inherits(t,e),_createClass(t,[{key:"render",value:function(){var e=_extends({},this.props);return this.context.radioGroup&&(e.onChange=this.context.radioGroup.onChange,e.checked=this.props.value===this.context.radioGroup.value,e.disabled=this.props.disabled||this.context.radioGroup.disabled),React.createElement(Radio,e)}}]),t}(React.Component);export default RadioButton;RadioButton.defaultProps={prefixCls:"dt-radio-button"},RadioButton.contextTypes={radioGroup:PropTypes.any};