-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当Field.Checkbox为multiple状态的时候 里面这段代码会报错 0.3.20版本 #56
Comments
另外单选和多选 组件为什么没有分开呢 这样用户使用习惯不一致 |
const selected = multiple
? (value as T[]).indexOf(checkboxValue) > -1
: value === checkboxValue 这里报错可能是你给的值是 null,或者非数组的值导致的。 |
这个问题暂时没有比较好的答案,许多组件都是多选、单选两个模式都可以使用。 |
I didn't pass a value 做的是一个非受控组件 |
const options = new Array(6).fill(0).map((_, index) => ({
value: index + 1,
label: `选项${index + 1}`,
}))
const Demo = () => {
return <>
<Checkbox.Group options={options} />
<Field.Checkbox title="多选:非受控" multiple options={options} />
</>
} |
真心建议把单选Radio和Checkbox分开 或者把Checkbox的圆形图标 多选的时候改成方形 这是用户使用习惯的问题 不然使用的时候还得告诉用户 这是可以多选的 |
可以在下个大版本区分出来,这个版本暂时这样。 |
目前这个版本解决方案就是在initialValues中声明一下默认值 可以为空数组 |
const selected = multiple
? (value as T[]).indexOf(checkboxValue) > -1
: value === checkboxValue
The text was updated successfully, but these errors were encountered: