New search
This commit is contained in:
parent
0c06410584
commit
69a4bcb238
17 changed files with 451 additions and 173 deletions
27
src/components/search_bar/search_bar.js
Normal file
27
src/components/search_bar/search_bar.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
const SearchBar = {
|
||||
data: () => ({
|
||||
searchTerm: undefined,
|
||||
hidden: true,
|
||||
error: false,
|
||||
loading: false
|
||||
}),
|
||||
watch: {
|
||||
'$route': function (route) {
|
||||
if (route.name === 'search') {
|
||||
this.searchTerm = route.query.query
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
find (searchTerm) {
|
||||
this.$router.push({ name: 'search', query: { query: searchTerm } })
|
||||
this.$refs.searchInput.focus()
|
||||
},
|
||||
toggleHidden () {
|
||||
this.hidden = !this.hidden
|
||||
this.$emit('toggled', this.hidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default SearchBar
|
Loading…
Add table
Add a link
Reference in a new issue