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 should repeat-timeout on button make replaced in V1?

    Framework
    3
    12
    376
    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.
    • P
      paul last edited by

      I noticed that the repeat-timeout prop on a QBtn is no longer working.
      How should this be handled in V1?
      thanks a lot
      paul.

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

        Looks like multiple clicks aren’t supported. If you need them, please create a feature request (issue) on Github.

        Scott

        1 Reply Last reply Reply Quote 0
        • P
          paul last edited by

          @s-molinari could the v-touch-repeat directive be an alternative?

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

            https://v1.quasar-framework.org/vue-directives/touch-repeat

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

              @paul - Looks like it is! 😁

              Scott

              1 Reply Last reply Reply Quote 0
              • P
                paul last edited by

                @rstoenescu @s-molinari
                Thanks for the help
                In pre V1, it was possible to provide a function for calculating the timeout.
                Is something similar still possible?

                <template>
                  <!-- Click and hold to trigger every second -->
                  <q-btn @click="clickHandler" :repeat-timeout="1000" label="Click Me" />
                
                  <!-- Click and hold to trigger faster over time -->
                  <q-btn @click="clickHandler" :repeat-timeout="repeatFunction" label="Click Me" />
                </template>
                <script>
                  export default {
                    methods: {
                      clickHandler () {
                        console.log('Handler Triggered')
                      },
                      repeatFunction (timesTriggered) {
                        // first time timesTriggered is 0, so we add 1
                        // to be sure we don't divide by 0
                        return 1000 / (timesTriggered + 1)
                      }
                    }
                  }
                </script>
                
                1 Reply Last reply Reply Quote 0
                • s.molinari
                  s.molinari last edited by

                  The docs say the input value for the directive should be a function.

                  <div v-touch-repeat.mouse="myHandler">...</div>
                  

                  so with the second QBtn from your example above

                  <q-btn @click="clickHandler" v-touch-repeat.mouse="repeatFunction" label="Click Me" />
                  

                  Scott

                  1 Reply Last reply Reply Quote 0
                  • P
                    paul last edited by

                    @s-molinari Hi Scott. Thanks a lot.
                    Maybe we are in the right direction.
                    The missing piece is now what to do inside the repeatFunction ?
                    So, basically the repeatFunction should set now the arguments of the directive I think. No sure how that can be done.

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

                      What is it you want it to do?

                      Scott

                      1 Reply Last reply Reply Quote 0
                      • P
                        paul last edited by

                        @s-molinari Well, the same logic as the V17 repeat function example: the ‘longer’ your press the button the ‘faster’ the timeout becomes.
                        So in fact I would like to generate, in the V1 spirit something like:
                        v-touch-repeat.mouse:0:500:499:498:497:496:495… 1, So every press increases the speed.

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

                          Ah. Hmm… not sure how to get that same effect. Maybe have a look at the directive’s source code. That might get you further?

                          https://github.com/quasarframework/quasar/blob/dev/quasar/src/directives/TouchRepeat.jss

                          Scott

                          1 Reply Last reply Reply Quote 0
                          • P
                            paul last edited by

                            @s-molinari good suggestion.
                            const durations = typeof binding.arg === ‘string’ && binding.arg.length
                            ? binding.arg.split(’:’).map(val => parseInt(val, 10))
                            : [0, 600, 300]

                            At first glance, a javascript generator (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator) could be a good candidate for providing a custom sequence like [500, 499, 498, …] but I can perfectly imagine/understand that the ‘quasar framework board’ has other priorities than looking into that 🙂

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