diff --git a/components/tag/index.jsx b/components/tag/index.jsx index b4f21cafd383663b0cf31974639c34d93d63d70c..c037f637a5374cc5e3a61a910af199bca763a345 100644 --- a/components/tag/index.jsx +++ b/components/tag/index.jsx @@ -14,10 +14,6 @@ class AntTag extends React.Component { close(e) { let dom = React.findDOMNode(this); - dom.style.width = dom.offsetWidth + 'px'; - // Magic code - // 重复是去除浏览器渲染bug; - dom.style.width = dom.offsetWidth + 'px'; this.setState({ closing: true }); @@ -30,6 +26,11 @@ 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 ? : ''; @@ -38,17 +39,18 @@ class AntTag extends React.Component { let className = this.props.prefixCls + ' ' + colorClass; className = this.state.closing ? className + ' ' + this.props.prefixCls + '-close' : className; - return (this.state.closed && !this.state.closing) ? null :
- - {close} -
; + return (this.state.closed && !this.state.closing) ? null + :
+ + {close} +
; } } AntTag.defaultProps = { prefixCls: prefixCls, closable: false, - onClose: function () {} + onClose: function() {} }; export default AntTag; diff --git a/nico.js b/nico.js index c785105686f9873ed41bd99c18260bcafc3a1048..10845fe98d8d55c0322f3f88bbd20e3da2421abf 100644 --- a/nico.js +++ b/nico.js @@ -90,8 +90,7 @@ exports.middlewares = [ watchOptions: { aggregateTimeout: 300, poll: true - }, - quiet: true + } }); try { return handler(req, res, next);