Fix ft-input from rewriting itself when search suggestions are active

This commit is contained in:
Preston 2020-06-19 15:58:59 -04:00
parent 6e5a1a1085
commit 0428891773
4 changed files with 4 additions and 10 deletions

View File

@ -49,6 +49,7 @@ export default Vue.extend({
},
mounted: function () {
this.id = this._uid
this.inputData = this.value
setTimeout(this.addListener, 200)
},
@ -57,9 +58,8 @@ export default Vue.extend({
this.$emit('click', this.inputData)
},
handleInput: function (input) {
this.inputData = input
this.$emit('input', input)
handleInput: function () {
this.$emit('input', this.inputData)
},
addListener: function () {

View File

@ -15,7 +15,7 @@
<input
:id="id"
:list="idDataList"
:value="value"
v-model="inputData"
class="ft-input"
type="text"
:placeholder="placeholder"

View File

@ -17,7 +17,6 @@ export default Vue.extend({
component: this,
windowWidth: 0,
showFilters: false,
searchValue: '',
searchSuggestionsDataList: []
}
},
@ -126,20 +125,17 @@ export default Vue.extend({
getSearchSuggestionsLocal: function (query) {
if (query === '') {
this.searchSuggestionsDataList = []
this.searchValue = ''
return
}
ytSuggest(query).then((results) => {
this.searchSuggestionsDataList = results
this.searchValue = query
})
},
getSearchSuggestionsInvidious: function (query) {
if (query === '') {
this.searchSuggestionsDataList = []
this.searchValue = ''
return
}
@ -153,7 +149,6 @@ export default Vue.extend({
this.$store.dispatch('invidiousAPICall', searchPayload).then((results) => {
this.searchSuggestionsDataList = results.suggestions
this.searchValue = query
}).error((err) => {
console.log(err)
if (this.backendFallback) {

View File

@ -40,7 +40,6 @@
class="searchInput"
:is-search="true"
:data-list="searchSuggestionsDataList"
:value="searchValue"
@input="getSearchSuggestionsDebounce"
@click="goToSearch"
/>