1
This commit is contained in:
@@ -32,9 +32,12 @@ const CancelPopup = forwardRef((props, ref) => {
|
||||
show: (onAct) => {
|
||||
onFinish.current = onAct;
|
||||
setVisible(true);
|
||||
setTimeout(() => {
|
||||
inputRef.current && inputRef.current.focus();
|
||||
}, 0);
|
||||
// 使用 requestAnimationFrame 替代 setTimeout(0),性能更好
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
inputRef.current && inputRef.current.focus();
|
||||
});
|
||||
});
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user