Choice
ChoiceList 组件中的选项。配合 ChoiceList 组件使用,将指示选项呈现为单选按钮或复选框。
预览

示例代码
render('Checkout::Dynamic::Render', () => {
return (
<ChoiceList name="choice" type="checkbox" value="first" onChange={(value) => {
console.log(`onChange event with value: ${value}`);
}}>
<Choice id="first">Ship</Choice>
<Choice id="second">Pickup</Choice>
</ChoiceList>
);
});
ChoiceProps
提示
标注 ? 的属性为可选,未标注 ? 的属性为必选。
id
string
用于标识当前组件的唯一标识符。Choice 组件 ID 为必传,不允许未设置。
disabled?
boolean
是否禁用。true 为禁用,false 为非禁用。
accessibilityLabel?
string
设置该组件的标签,将用于屏幕阅读器用户理解组件功能。配置该功能等同设置 aria-label 属性。
这篇文章对你有帮助吗?