vue.jsvuetify.js

How to call a function on append-icon click in Vuetify.js?


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>


Solution

  • Solved it, here's the solution:

    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)