未验证 提交 cb5302ea 编写于 作者: C cuicuiworld 提交者: GitHub

fix: checkboxgroup组件通过options渲染时组件选中值反填问题 (#680)

上级 f5746bad
......@@ -96,8 +96,8 @@ export const CheckboxGroup = React.forwardRef(
}
function validateChecked(value: any) {
if (innerValue === null) return false
return innerValue === value
if (!innerValue) return false
return innerValue?.indexOf(value) > -1
}
function getParentVals() {
......@@ -137,7 +137,7 @@ export const CheckboxGroup = React.forwardRef(
/>
)
})
}, [innerValue, options])
}, [innerValue, options, innerDisabled, max])
return (
<div className={`${b()} ${className || ''}`} {...rest}>
......
......@@ -96,8 +96,8 @@ export const CheckboxGroup = React.forwardRef(
}
function validateChecked(value: any) {
if (innerValue === null) return false
return innerValue === value
if (!innerValue) return false
return innerValue?.indexOf(value) > -1
}
function getParentVals() {
......@@ -137,7 +137,7 @@ export const CheckboxGroup = React.forwardRef(
/>
)
})
}, [innerValue, options, innerDisabled])
}, [innerValue, options, innerDisabled, max])
return (
<div className={`${b()} ${className || ''}`} {...rest}>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册