fix: avoid window scrolling to the top when treeSelect input first focus

pull/398/head
tangjinzhou 2018-12-26 18:11:06 +08:00
parent 983318b985
commit 1393563c9b
1 changed files with 2 additions and 1 deletions

View File

@ -70,11 +70,12 @@ const SearchInput = {
*/
focus (isDidMount) {
if (this.inputRef.current) {
this.inputRef.current.focus()
if (isDidMount) {
setTimeout(() => {
this.inputRef.current.focus()
}, 0)
} else { // set it into else, Avoid scrolling when focus
this.inputRef.current.focus()
}
}
},