Vuetify - How to trigger method when clear a v-text-field

Francis Beaulieu picture Francis Beaulieu · Sep 30, 2018 · Viewed 11.8k times · Source

is there a way to call a method while clearing a text-field with Vuetify?

<v-text-field
    class="mt-2 mb-0"
    clearable
    solo
    v-model="searchQuery"
    append-icon="search"
    @click:append-outer="searchCos"
   label="Nom de compagnies ou mots-clés">
 </v-text-field>

...
onClear() {
doSomethingHere
}

Thanks

Francis

Answer

&#223;iansor &#197;. &#197;lmerol picture ßiansor Å. Ålmerol · Sep 30, 2018

You can use the @click:clear="()" so you can clear your text at the same time it will call the function.

Here's the example

https://codepen.io/anon/pen/ePmLOg?editors=1010