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

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

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