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

    Disabled button fires a click event

    Framework
    5
    9
    8447
    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.
    • R
      rbocharov last edited by

      Hi, I’m not sure if it is expected behavior on simply I’m doing something wrong. I place button component like following:

      <button class=“primary” :class="{‘disabled’: state.disabled}" @click=“confirm()”>Confirm</button>

      When I hover a mouse over the button, it shows up as disabled. However if I click on it, the confirm() event is fired. Is that expected?

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by

        Yes. In your confirm() method check to make sure the disabled prop isn’t true (or is false).

        Scott

        1 Reply Last reply Reply Quote 0
        • benoitranque
          benoitranque last edited by

          That or add :disabled="state.disabled" to your button. Currently you only bind the class

          1 Reply Last reply Reply Quote 0
          • s.molinari
            s.molinari last edited by

            Hey Ben, @benoitranque

            I might be wrong, but isn’t :disable a 0.14 improvement and is actually part of the new q-btn component?

            Scott

            1 Reply Last reply Reply Quote 0
            • rstoenescu
              rstoenescu Admin last edited by

              @rbocharov <button> is not a Vue component in v0.13 (there will be a QBtn in v0.14) but a native DOM element, so disabled as a CSS class does not interferes with the native click event. It’s your responsibility in your event handler to manage the state. Again, in v0.14 by introducing a Vue component (QBtn) this will change.

              1 Reply Last reply Reply Quote 0
              • R
                rbocharov last edited by

                Ok, got it. Thank you for clarification.

                1 Reply Last reply Reply Quote 0
                • benoitranque
                  benoitranque last edited by

                  @s-molinari that is correct. But disabled is a native html property. Its in the vuejs docs. I think ☺

                  1 Reply Last reply Reply Quote 0
                  • s.molinari
                    s.molinari last edited by s.molinari

                    Ah yes. Got it. Always learning 😄

                    https://jsfiddle.net/krrh2hzy/2/

                    Scott

                    1 Reply Last reply Reply Quote 0
                    • Q
                      QuaSam last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post