diff --git a/src/components/checkbox/index.js b/src/components/checkbox/index.js index 93d064183..957669789 100644 --- a/src/components/checkbox/index.js +++ b/src/components/checkbox/index.js @@ -5,9 +5,8 @@ import classNames from 'classnames' import AtComponent from '../../common/component' export default class AtCheckbox extends AtComponent { - handleClick (idx) { - const { selectedList, options } = this.props - const option = options[idx] + handleClick (option) { + const { selectedList } = this.props const { disabled, value } = option if (disabled) return @@ -31,14 +30,13 @@ export default class AtCheckbox extends AtComponent { const rootCls = classNames('at-checkbox', className) return - { options.map((option, idx) => { + { options.map(option => { const { value, disabled, label, desc } = option const optionCls = classNames('at-checkbox__option', { 'at-checkbox__option--disabled': disabled, 'at-checkbox__option--selected': selectedList.includes(value) }) - - return + return