fix: avoid page scrolling when treeSelect is first opened

pull/344/head
tangjinzhou 2018-12-26 20:43:13 +08:00
parent 793a5ac97e
commit 31862e1112
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()
}
}
},