From 57c9d580fb1191cf16879ffc05e291eeb0616852 Mon Sep 17 00:00:00 2001 From: lishengzxc Date: Mon, 4 Dec 2017 17:13:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9D=9E=E5=8F=97=E6=8E=A7?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F=E4=B8=8B=EF=BC=8CCollapse=20=E6=9C=AA?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=B8=B2=E6=9F=93=E5=B0=B1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=20onChange=20=E5=9B=9E=E8=B0=83=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Collapse.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Collapse.jsx b/src/Collapse.jsx index 808cac4..2333243 100644 --- a/src/Collapse.jsx +++ b/src/Collapse.jsx @@ -96,9 +96,12 @@ class Collapse extends Component { setActiveKey(activeKey) { if (!('activeKey' in this.props)) { - this.setState({ activeKey }); + this.setState({ activeKey }, () => { + this.props.onChange(this.props.accordion ? activeKey[0] : activeKey); + }); + } else { + this.props.onChange(this.props.accordion ? activeKey[0] : activeKey); } - this.props.onChange(this.props.accordion ? activeKey[0] : activeKey); } render() {