From e00a562ca9a0ad9755c2fdb29de98a9c51413673 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 30 Jul 2015 23:52:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20Tag=20=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E7=9A=84=E9=80=BB=E8=BE=91,=20#84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/tag/index.jsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/components/tag/index.jsx b/components/tag/index.jsx index 61389d89c..ab3c57854 100644 --- a/components/tag/index.jsx +++ b/components/tag/index.jsx @@ -2,18 +2,25 @@ import React from 'react'; const prefixCls = 'ant-tag'; class AntTag extends React.Component { - destroy(e) { - let node = React.findDOMNode(this); - React.unmountComponentAtNode(node); - node.parentNode.removeChild(node); + constructor(props) { + super(props); + + this.state = { + closed: false + }; + } + close(e) { + this.setState({ + closed: true + }); this.props.onClose.call(this, e); } render() { let close = this.props.closable ? - : ''; + : ''; let colorClass = this.props.prefixCls + '-' + this.props.color; - return
+ return this.state.closed ? null :
{close}
;