fix: fix tooltip being covered by other elements (#1717)

* docs: fix incorrect content for emit method in event api

* fix: Fix tooltip being covered by other elements
This commit is contained in:
beautiful-boyyy 2023-03-15 15:14:24 +08:00 committed by GitHub
parent 4d4a8a6d6f
commit 95a1137b46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,12 +3,10 @@ import { TipItem } from './tip-item';
import { tipHandler } from './tip-handler'; import { tipHandler } from './tip-handler';
export class TipContainer extends Component { export class TipContainer extends Component {
private dispose?: () => void;
shouldComponentUpdate() { shouldComponentUpdate() {
return false; return false;
} }
private dispose?: () => void;
componentDidMount() { componentDidMount() {
const over = (e: MouseEvent) => tipHandler.setTarget(e.target as any); const over = (e: MouseEvent) => tipHandler.setTarget(e.target as any);
const down = () => tipHandler.hideImmediately(); const down = () => tipHandler.hideImmediately();
@ -27,10 +25,11 @@ export class TipContainer extends Component {
} }
render() { render() {
return ( return window.ReactDOM.createPortal(
<div className="lc-tips-container"> <div className="lc-tips-container">
<TipItem /> <TipItem />
</div> </div>,
document.querySelector('body')!,
); );
} }
} }