Document. The onkeydown=e=& gt; {
Let ev=document. All? Window. The event: e;
If (ev) keyCode===13) {
Enclosing searchFeedback ();
}
};
};
With the react framework
As shown in figure, wrote this method under the page, but press enter after switching to other pages or call the method, how to solve this global problem,
CodePudding user response:
Write in life cycle, loading when loading the incident, component destroyed before emptying the eventDocument. The onkeydown=null