Skip to content

Commit 2dfc096

Browse files
author
liyuan-meng
committed
fix: [Radio] 解决给 ComplexRadio 设置 className 后,所有类被覆盖的问题
1 parent 076f58a commit 2dfc096

4 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/components/complex-radio/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export default function ComplexRadio(props) {
1818
titleStyle,
1919
type,
2020
borderRadiusSize,
21+
className,
2122
...otherProps
2223
} = props;
2324

@@ -35,6 +36,7 @@ export default function ComplexRadio(props) {
3536
[`${classSelector}-card-disabled`]: type === 'card' && props.disabled,
3637
[`${classSelector}-card-checked`]: type === 'card' && props.checked,
3738
[`${classSelector}-radius-${borderRadiusSize}`]: true,
39+
[className]: !!className,
3840
})}
3941
{...otherProps}
4042
>

src/components/radio/complexDemos/basic.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ export default function ComplexRadioDemo() {
1919
<div style={{ marginBottom: 50 }}>
2020
<h5>标题+头像</h5>
2121
<ComplexRadio
22+
radioClassName="test1"
23+
className="test2"
2224
titleStyle={{ minWidth: 'fit-content' }}
2325
title="单选文字"
2426
imgSrc="https://brand-guide.shuyun.com/IAM/52e939494f3b.png"

src/components/radio/complexDemos/card.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ export default function ComplexRadioDemo() {
2525
<div>
2626
<div>
2727
<h5>基础卡片</h5>
28-
<Radio.Group value={value} defaultValue={"E"} onChange={onChange} horizontal style={{ flexWrap: 'wrap' }}>
28+
<Radio.Group value={value} defaultValue={"E"} onChange={onChange} horizontal style={{ flexWrap: 'wrap' }} className="test">
2929
{radioList.map((item, index) => (
3030
<ComplexRadio
31+
radioClassName="test1"
32+
className="test2"
3133
title={item.label}
3234
value={item.value}
3335
type="card"

src/components/radio/complexDemos/group.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function ComplexRadioDemo() {
2525
<div style={{ display: 'flex', justifyContent: 'space-around', flexWrap: "wrap" }}>
2626
<div>
2727
<h5>标题+头像</h5>
28-
<Radio.Group vertical value={value} defaultValue={"E"} onChange={onChange}>
28+
<Radio.Group vertical value={value} defaultValue={"E"} onChange={onChange} className="test">
2929
{radioList.map((item, index) => (
3030
<ComplexRadio
3131
title={item.label}

0 commit comments

Comments
 (0)