Skip to content

Commit c823a7a

Browse files
author
liyuan-meng
committed
feat: [Radio] 给Radio添加radioClassName参数,设置自定义类
1 parent a87e202 commit c823a7a

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/radio/demos/complex.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class NestingRadio extends React.Component {
5353
onChange={this.onChildChange}
5454
vertical
5555
>
56-
<Radio value={1}>mysql</Radio>
56+
<Radio value={1} radioClassName="test1" className="test2">mysql</Radio>
5757
<Radio value={2}>mogondb</Radio>
5858
</Radio.Group>
5959
</Radio.Group>

src/components/radio/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,12 @@ class Radio extends React.Component {
4646
textStyle,
4747
desc,
4848
supportUnSelect,
49+
radioClassName,
4950
...otherProps
5051
} = this.props;
5152
return (
52-
<div className={`${classSelector}-container`}>
53-
<label className={classnames(classSelector, className)} style={style}>
53+
<div className={classnames(`${classSelector}-container`, { [radioClassName]: !!radioClassName })}>
54+
<label className={classnames(classSelector, { [className]: !!className })} style={style}>
5455
<span className={`${classSelector}-wrapper`} style={radioStyle}>
5556
<input
5657
{...otherProps}

src/components/radio/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ group:
3636
| disabled | 是否禁用 | boolean | false |
3737
| desc | 单选提示 | string 或 React.node | null |
3838
| supportUnSelect | 是否支持反选 | boolean | false |
39+
| radioClassName | Radio 和 ComplexRadio 类名 | string | -- |
3940

4041
### API ComplexRadio
4142

0 commit comments

Comments
 (0)