mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
still use Magic offsetWidth set
This commit is contained in:
parent
75fca79313
commit
9b28e46d4c
@ -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 ?
|
||||
<i className="anticon anticon-cross" onClick={this.close.bind(this)}></i> : '';
|
||||
|
Loading…
Reference in New Issue
Block a user