diff --git a/components/tag/index.jsx b/components/tag/index.jsx index c037f637a5..70972fcb2e 100644 --- a/components/tag/index.jsx +++ b/components/tag/index.jsx @@ -14,6 +14,9 @@ class AntTag extends React.Component { close(e) { let dom = React.findDOMNode(this); + dom.style.width = dom.offsetWidth + 'px'; + // It's Magic Code, don't know why + dom.style.width = dom.offsetWidth + 'px'; this.setState({ closing: true }); @@ -26,11 +29,6 @@ class AntTag extends React.Component { this.props.onClose.call(this, e); } - componentDidMount() { - let dom = React.findDOMNode(this); - dom.style.width = (dom.getBoundingClientRect().width || dom.offsetWidth) + 'px'; - } - render() { let close = this.props.closable ? : '';