forked from p96170835/amis
PopOver 弹出时给容器dom节点添加 has-popover 类名
This commit is contained in:
parent
bc3a8fb0d9
commit
df352d65e8
|
@ -52,14 +52,23 @@ export class PopOver extends React.PureComponent<PopOverPorps, PopOverState> {
|
|||
yOffset: 0,
|
||||
};
|
||||
|
||||
parent:HTMLElement;
|
||||
|
||||
componentDidMount() {
|
||||
this.mayUpdateOffset();
|
||||
const dom = findDOMNode(this) as HTMLElement;
|
||||
this.parent = dom.parentNode as HTMLElement;
|
||||
this.parent.classList.add('has-popover');
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.mayUpdateOffset();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.parent && this.parent.classList.remove('has-popover');
|
||||
}
|
||||
|
||||
mayUpdateOffset() {
|
||||
let offset: Offset;
|
||||
let getOffset = this.props.offset;
|
||||
|
|
Loading…
Reference in New Issue