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,
|
yOffset: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
parent:HTMLElement;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.mayUpdateOffset();
|
this.mayUpdateOffset();
|
||||||
|
const dom = findDOMNode(this) as HTMLElement;
|
||||||
|
this.parent = dom.parentNode as HTMLElement;
|
||||||
|
this.parent.classList.add('has-popover');
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
this.mayUpdateOffset();
|
this.mayUpdateOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
this.parent && this.parent.classList.remove('has-popover');
|
||||||
|
}
|
||||||
|
|
||||||
mayUpdateOffset() {
|
mayUpdateOffset() {
|
||||||
let offset: Offset;
|
let offset: Offset;
|
||||||
let getOffset = this.props.offset;
|
let getOffset = this.props.offset;
|
||||||
|
|
Loading…
Reference in New Issue