需要在ANTD中进行默认检查中的广播按钮
我有一个无线电按钮组,其中包含来自数组的动态数据。 这是代码:
<Radio.Group
options={uniqueRadioElements}
onChange={onCategorySelect}
value={selectedCategory}
optionType="button"
buttonStyle="solid"
className="select-category"
checked="true"
/>
<Col span={24}>
<div className="professionals-wrapper">
{arrayOfElements
.filter((item) => item.category === selectedCategory)
.map((item) => {
return (
<div className="details-of-categories">
<Image
src="/images/clinic.png"
preview={false}
alt="photo 4"
/>
<h3>{item.title}</h3>
<Rate defaultValue={4} disabled />
</div>
)
})}
</div>
</Col>
我想将其默认检查为无线电按钮组的特定元素
I have a Radio Button Group with dynamically data coming from an array.
Here's the code :
<Radio.Group
options={uniqueRadioElements}
onChange={onCategorySelect}
value={selectedCategory}
optionType="button"
buttonStyle="solid"
className="select-category"
checked="true"
/>
<Col span={24}>
<div className="professionals-wrapper">
{arrayOfElements
.filter((item) => item.category === selectedCategory)
.map((item) => {
return (
<div className="details-of-categories">
<Image
src="/images/clinic.png"
preview={false}
alt="photo 4"
/>
<h3>{item.title}</h3>
<Rate defaultValue={4} disabled />
</div>
)
})}
</div>
</Col>
I want to make it default checked for a specific element of Radio Button Group
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我的解决方案
Here's my solution using with From
您可以将DIP DEFAULT检查的Prop删除检查到所需的特定索引中。第一个示例是:
在您的情况下,我将删除检查值并添加默认值。
You can add the prop defaultChecked to the specific index you want. An example for the first one would be:
In your case I would delete the checked value and add the defaultChecked.