Input components now emit a "enter" event and our torrent input searches if "enter" event is received

This commit is contained in:
2019-10-04 00:28:27 +02:00
parent c339045a0e
commit 6f74a5bff4
2 changed files with 5 additions and 2 deletions

View File

@@ -78,7 +78,7 @@
justify-content: center;"
v-if="editSearchQuery">
<seasonedInput text="Torrent query" icon="_torrents" @inputValue="(val) => editedSearchQuery = val"/>
<seasonedInput text="Torrent query" icon="_torrents" @inputValue="(val) => editedSearchQuery = val" @enter="fetchTorrents(editedSearchQuery)" />
<div style="height: 45px; width: 5px;"></div>

View File

@@ -2,7 +2,7 @@
<div class="group" :class="{ completed: value.length > 0 }">
<svg class="group__input-icon"><use v-bind="{'xlink:href':'#icon' + icon}"></use></svg>
<input class="group__input" :type="tempType || type" ref="plex_username"
v-model="value" :placeholder="text" @input="handleInput" />
v-model="value" :placeholder="text" @keyup.enter="submit" @input="handleInput" />
<i v-if="value.length > 0 && type === 'password'" @click="toggleShowPassword" class="group__input-show noselect">show</i>
</div>
@@ -19,6 +19,9 @@ export default {
return { value: '', tempType: undefined }
},
methods: {
submit(event) {
this.$emit('enter')
},
handleInput(value) {
console.log('this.value', this.value)
this.$emit('inputValue', this.value)