I need the append-icon="close"
to call @click="clearSearch()"
Right now I'm implementing it with a dedicated button:
<v-text-field
v-model="search"
class="search"
label="search"
prepend-icon="search"
append-icon="close">
</v-text-field>
<v-btn @click="clearSearch()"></v-btn>
append-icon-cb="clearSearch()"
but it doesn't work and I don't know whyclearable
, it clears the input but all the elements stay "filtered". I don't know how clearable
works but my clearSearch()
method simply does: clearSearch() {this.search = ""}
and it works, that's why I use the custom clear input methodIcon eventsclick:prepend , click:append , click:append-outer , and click:clear will be emitted when you click on the respective icon. Note that these events will not be fired if the slot is used instead.
You can use the @click:clear="()" so you can clear your text at the same time it will call the function. Show activity on this post. Use the clear-icon-cb prop. This allows you to use a custom callback function when the clear icon when clicked.
Vuetify is a Vue UI Library with beautifully handcrafted Material Components. No design skills required — everything you need to create amazing applications is at your fingertips. Get Started.
Use @click:append="clearSearch"
, :append-icon-cb
is deprecated. (Source)
To avoid that problem you should bind the attribute with :
symbol:
:append-icon-cb="clearSearch"
And don't put ()
otherwise it will not work (as @Traxo mentioned)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With