Commit 688f53ec authored by Dennis Tang's avatar Dennis Tang

use v-model for dropdown search input

parent 86413c95
...@@ -3,29 +3,31 @@ import { __ } from '~/locale'; ...@@ -3,29 +3,31 @@ import { __ } from '~/locale';
export default { export default {
props: { props: {
searchQuery: {
type: String,
required: false,
default: '',
},
placeholderText: { placeholderText: {
type: String, type: String,
required: true, required: true,
default: __('Search'), default: __('Search'),
}, },
}, },
data() {
return { searchQuery: this.value };
},
watch: {
searchQuery(query) {
this.$emit('input', query);
},
},
}; };
</script> </script>
<template> <template>
<div class="dropdown-input"> <div class="dropdown-input">
<input <input
autocomplete="off"
class="dropdown-input-field" class="dropdown-input-field"
type="search" type="search"
v-model="searchQuery"
:placeholder="placeholderText" :placeholder="placeholderText"
:searchQuery="searchQuery" autocomplete="off"
@input="$emit('input', $event.target.value)"
/> />
<i <i
aria-hidden="true" aria-hidden="true"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment