mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-04 04:59:17 +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,9 +96,10 @@ export class TooltipWrapper extends React.Component<
|
|||||||
|
|
||||||
hide() {
|
hide() {
|
||||||
waitToHide = null;
|
waitToHide = null;
|
||||||
this.setState({
|
this.moutned &&
|
||||||
show: false
|
this.setState({
|
||||||
});
|
show: false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getChildProps() {
|
getChildProps() {
|
||||||
|
Loading…
Reference in New Issue
Block a user