diff options
author | DorraJaouad <dorra.jaoued7@gmail.com> | 2023-06-27 12:58:30 +0200 |
---|---|---|
committer | backportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com> | 2023-08-02 14:12:38 +0000 |
commit | ad00a2fed0852c0849b314bb7ee8538378a81414 (patch) | |
tree | 8d5b94410418db9123354fff6fe0c3054d25c050 /src/components/LeftSidebar/SearchBox/SearchBox.vue | |
parent | 166a3dbd5e4a4382b341b70fc1fa80ea64eb0aea (diff) |
Search box fixes
Signed-off-by: DorraJaouad <dorra.jaoued7@gmail.com>
Diffstat (limited to 'src/components/LeftSidebar/SearchBox/SearchBox.vue')
-rw-r--r-- | src/components/LeftSidebar/SearchBox/SearchBox.vue | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/components/LeftSidebar/SearchBox/SearchBox.vue b/src/components/LeftSidebar/SearchBox/SearchBox.vue index b3fa6e9c1..11fe1a4a0 100644 --- a/src/components/LeftSidebar/SearchBox/SearchBox.vue +++ b/src/components/LeftSidebar/SearchBox/SearchBox.vue @@ -22,12 +22,13 @@ <template> <form @submit.prevent="handleSubmit"> <NcTextField ref="searchConversations" - :value.sync="localValue" + :value="value" :label="placeholderText" :show-trailing-button="isSearching" :disabled="disabled" trailing-button-icon="close" v-on="$listeners" + @update:value="updateValue" @trailing-button-click="abortSearch" @keypress.enter="handleSubmit"> <Magnify :size="16" /> @@ -57,8 +58,7 @@ export default { default: t('spreed', 'Search …'), }, /** - * The value of the input field, when receiving it as a prop the localValue - * is updated. + * The value of the input field. */ value: { type: String, @@ -79,25 +79,12 @@ export default { emits: ['update:value', 'input', 'submit', 'abort-search'], - data() { - return { - localValue: '', - } - }, computed: { cancelSearchLabel() { return t('spreed', 'Cancel search') }, }, - watch: { - localValue(localValue) { - this.$emit('update:value', localValue) - this.$emit('input', localValue) - }, - value(value) { - this.localValue = value - }, - }, + mounted() { this.focusInputIfRoot() /** @@ -109,6 +96,10 @@ export default { EventBus.$off('route-change', this.focusInputIfRoot) }, methods: { + updateValue(value) { + this.$emit('update:value', value) + this.$emit('input', value) + }, // Focus the input field of the searchbox component. focusInput() { this.$refs.searchConversations.$el.focus() |