No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to wait for q-input change event execution

    Help
    2
    4
    2905
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      apptaro last edited by apptaro

      I want to wait for q-input change event execution when a button is clicked, but this.$nextTick doesn’t seem to do it. I could do setTimeout with a large number of milliseconds, but it is not a good way.

      Test Case:
      https://jsfiddle.net/apptaro/fv269qn0/13/
      Enter some text after “abc”, and click “Submit” button directly without losing focus from the input field. Inside onClick, I want to wait for onChange execution using this.$nextTick, but I can’t.

      1 Reply Last reply Reply Quote 0
      • T
        turigeza last edited by

        Can you not use v-model ?

        The problem is that text will not change until you the focus leaves the input which seems after the @click.
        https://jsfiddle.net/gezaatturigezacom/fzsantm5/

        1 Reply Last reply Reply Quote 0
        • A
          apptaro last edited by

          Can you not use v-model ?
          No, in my case, I need to check and replace the value when needed on blur, so I need to use :value and @change. I can’t use v-model or @input.

          I found it works correctly if I use a simple text input and a simple button:
          https://jsfiddle.net/apptaro/fv269qn0/22/

          I also found it works correctly if I use Quasar v1.0.0-beta.18:
          https://jsfiddle.net/apptaro/fv269qn0/29/

          Finally, I solved the issue by using @change.native:
          https://jsfiddle.net/apptaro/fv269qn0/32/

          Thank you!

          1 Reply Last reply Reply Quote 0
          • A
            apptaro last edited by apptaro

            Actually, I found that I have to wait 200ms:
            https://github.com/quasarframework/quasar/blob/v0.17/src/mixins/input.js#L41
            https://jsfiddle.net/apptaro/fv269qn0/36/

            So, here’s the note:
            @change and @blur of q-input in quasar 0.17 are delayed 200ms!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post