mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
simplified searchableInput further - fixed on Enter
This commit is contained in:
parent
c7fbe9beef
commit
4a5c56203b
@ -78,7 +78,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
searchValue: '',
|
searchValue: '',
|
||||||
value: '',
|
value: '',
|
||||||
unprocessedSearchInput: '',
|
|
||||||
searchProcess: null,
|
searchProcess: null,
|
||||||
previousSearchTerm: '',
|
previousSearchTerm: '',
|
||||||
delay: 300,
|
delay: 300,
|
||||||
@ -105,7 +104,6 @@ export default {
|
|||||||
onInput(event) {
|
onInput(event) {
|
||||||
clearTimeout(this.searchProcess)
|
clearTimeout(this.searchProcess)
|
||||||
this.value = event.target ? event.target.value.replace(/\s+/g, ' ').trim() : ''
|
this.value = event.target ? event.target.value.replace(/\s+/g, ' ').trim() : ''
|
||||||
this.unprocessedSearchInput = this.value
|
|
||||||
if (isEmpty(this.value) || this.value.replace(/\s+/g, '').length < 3) {
|
if (isEmpty(this.value) || this.value.replace(/\s+/g, '').length < 3) {
|
||||||
this.clear()
|
this.clear()
|
||||||
return
|
return
|
||||||
@ -118,12 +116,11 @@ export default {
|
|||||||
onEnter(event) {
|
onEnter(event) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/search/search-results',
|
path: '/search/search-results',
|
||||||
query: { search: this.unprocessedSearchInput },
|
query: { search: this.value },
|
||||||
})
|
})
|
||||||
this.$emit('clearSearch')
|
this.$emit('clearSearch')
|
||||||
},
|
},
|
||||||
clear() {
|
clear() {
|
||||||
this.unprocessedSearchInput = ''
|
|
||||||
this.previousSearchTerm = ''
|
this.previousSearchTerm = ''
|
||||||
this.searchValue = ''
|
this.searchValue = ''
|
||||||
this.$emit('clearSearch')
|
this.$emit('clearSearch')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user