implement seach view autofocus #41
This commit is contained in:
parent
7c8a1bb423
commit
c1d78fa8c1
@ -100,9 +100,9 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
searching(value) {
|
searching(value) {
|
||||||
if (value) {
|
if (!value) {
|
||||||
if (this.$refs.searchTextInput) {
|
if (this.$refs.searchTextInput) {
|
||||||
this.$refs.searchTextInput.focus()
|
this.focusSearchText()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,6 +111,11 @@ export default {
|
|||||||
handleSubmit() {
|
handleSubmit() {
|
||||||
this.$router.push({ query: { query: this.searchText }})
|
this.$router.push({ query: { query: this.searchText }})
|
||||||
this.$store.dispatch('search/search')
|
this.$store.dispatch('search/search')
|
||||||
|
},
|
||||||
|
focusSearchText() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.searchTextInput.focus()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
Loading…
Reference in New Issue
Block a user