forked from nsjcy/frontEnd/nsjcy

LAPTOP-RI7D261L\Mr Ke
2020-02-26 8f619dde9e2382fc8a4f1e04fafde1418f06165b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React from 'react';
import './index.less';
 
class Radio extends React.PureComponent {
 
  handleChange = (e) => {
    const {
      onChange,
    } = this.props;
    if (onChange) {
      onChange(e);
    };
  }
 
  render() {
    const {
      defaultChecked,
      value,
      name,
      label,
      style,
    } = this.props;
    return (
      <label className="wowjoy-radio" style={style}>
        <input
          type="radio"
          name={name}
          value={value}
          defaultChecked={defaultChecked}
          onChange={this.handleChange}
          style={{ display: 'none' }}/>
        <span className="wowjoy-radio__inner"></span>
        <span className="wowjoy-radio__text">{label}</span>
      </label>
    );
  }
}
 
export default Radio;