mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 12:38:58 +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) {
|
close(e) {
|
||||||
let dom = React.findDOMNode(this);
|
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({
|
this.setState({
|
||||||
closing: true
|
closing: true
|
||||||
});
|
});
|
||||||
@ -26,11 +29,6 @@ class AntTag extends React.Component {
|
|||||||
this.props.onClose.call(this, e);
|
this.props.onClose.call(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
let dom = React.findDOMNode(this);
|
|
||||||
dom.style.width = (dom.getBoundingClientRect().width || dom.offsetWidth) + 'px';
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let close = this.props.closable ?
|
let close = this.props.closable ?
|
||||||
<i className="anticon anticon-cross" onClick={this.close.bind(this)}></i> : '';
|
<i className="anticon anticon-cross" onClick={this.close.bind(this)}></i> : '';
|
||||||
|
Loading…
Reference in New Issue
Block a user