From 134acbf2450ecd4d2203bf7c8bcd1b8c99152319 Mon Sep 17 00:00:00 2001 From: liaoxuezhi Date: Mon, 11 Nov 2019 14:26:06 +0800 Subject: [PATCH] =?UTF-8?q?select=20multi=20=E6=A8=A1=E5=BC=8F=20onChange?= =?UTF-8?q?=20=E4=BC=9A=E8=A7=A6=E5=8F=91=E5=A4=9A=E6=AC=A1,=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=95=B0=E5=80=BC=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Select.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/Select.tsx b/src/components/Select.tsx index f4cddadd..41dc325e 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -668,7 +668,9 @@ export class Select extends React.Component { this.handleChange(item)} + onChange={() => { + this.handleChange(item); + }} > {item.disabled ? item[labelField] @@ -758,7 +760,8 @@ export class Select extends React.Component { spinnerClassName, clearable, labelField, - disabled + disabled, + checkAll } = this.props; const selection = this.state.selection; @@ -770,7 +773,12 @@ export class Select extends React.Component { highlightedIndex={this.state.highlightedIndex} isOpen={this.state.isOpen} inputValue={inputValue} - onChange={this.handleChange} + onChange={ + /*展示 Checkbox 的时候,会出发多次 onChange 原因待查*/ multiple || + checkAll + ? noop + : this.handleChange + } onStateChange={this.handleStateChange} // onOuterClick={this.close} itemToString={item => (item ? item[labelField] : '')}