PopOver 弹出时给容器dom节点添加 has-popover 类名

This commit is contained in:
liaoxuezhi 2019-07-17 09:41:56 +08:00
parent bc3a8fb0d9
commit df352d65e8
1 changed files with 9 additions and 0 deletions

View File

@ -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;