Enter-Event in q-search component not triggered

  • I am using a q-search along with an q-autocomplete component like this:

    <q-autocomplete ref="autoComplete" v-model="searchModel" :delay="0" @search="searchAndSuggest" :max-results="3" :min-characters="1" @selected="selected">
      <q-search v-model="searchModel" placeholder="Zutaten" @enter="test()"></q-search>

    methods: {
    test () {
    console.log(‘enter pressed’)

    But unfortunalety the @enter event is not gonna be triggered.
    From the docs:
    @enter Triggered when Enter key is detected.

    How can I get that enter key pressed event?


  • Admin

    Hi, @enter="test" (notice no ending () ) --> otherwise you execute test() and the result (in this case undefined) is assigned as @enter handler.

  • Unfortunately this does not work either.
    In a simplified scenario with just a <q-search>-component I also can not trigger method call:

      <q-search v-model="searchModel" placeholder="Enter search text..." @input="search" @enter="search"></q-search>

    with method:

    search () {
    console.log(‘search triggered’)

  • Admin

    I just tested it and it works. What Quasar version (full string) are you using?

  • It´s “quasar-framework”: “^0.13.4”. Maybe I should update this…

  • Hi, Quasar framework 0.14.3, the enter event for the return key is not fired.

  • Admin

    This is an old thread. Quasar v0.14 has @keydown and @keyup events emitted, so no longer needing a @enter event.
    Always check documentation. Point @keydown to a function with one parameter (which will be the event itself), so check if it’s Enter key there.

Log in to reply

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.