mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 21:19:01 +08:00
修复一个 setState 给 unMounted 组件的问题
This commit is contained in:
parent
06e3eda803
commit
a7aa3f0528
@ -53,7 +53,8 @@ export class TooltipWrapper extends React.Component<
|
|||||||
};
|
};
|
||||||
|
|
||||||
target: HTMLElement;
|
target: HTMLElement;
|
||||||
timer: number;
|
timer: NodeJS.Timeout;
|
||||||
|
moutned = true;
|
||||||
constructor(props: TooltipWrapperProps) {
|
constructor(props: TooltipWrapperProps) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ export class TooltipWrapper extends React.Component<
|
|||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
clearTimeout(this.timer);
|
clearTimeout(this.timer);
|
||||||
|
this.moutned = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTarget() {
|
getTarget() {
|
||||||
@ -94,6 +96,7 @@ export class TooltipWrapper extends React.Component<
|
|||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
waitToHide = null;
|
waitToHide = null;
|
||||||
|
this.moutned &&
|
||||||
this.setState({
|
this.setState({
|
||||||
show: false
|
show: false
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user