-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support conditional binding for listeners like v-touch-pan #6083
Comments
@gruppler because the directive expects a handler, you can just supply a noop function. ie. https://codepen.io/metalsadman/pen/ExaRKyJ?editable=true&editors=111 |
The problem with that solution is it still captures the event even when inactive, preventing scrolling. |
…ing a nof function value quasarframework#6083
…ing a nof function value quasarframework#6083
Starting with future "quasar" v1.7.2, if the handler is a Function, it'll do something with it, otherwise it's gonna be equivalent to not having the touch directive(s) attached. So this will be perfectly valid: Again, if handler is not a Function, then it won't interfere with ANY events. |
Thank you so much! |
Is your feature request related to a problem? Please describe.
I want to conditionally capture swiping, but currently there doesn't seem to be a way to do this. To be clear, I don't want to capture/prevent touch-starts unless my handler is enabled, because this interferes with scrolling.
Describe the solution you'd like
If a handler is null, silently abort and unbind the listener. If the handler changes from null to a function, rebind the listener.
Describe alternatives you've considered
I can't think of any other way to accomplish this. Currently, I'm using the following code, which works but produces errors ("ctx.handler is not a function"):
v-touch-pan.prevent.mouse="board3D ? rotateBoard : null"
Additional context
Vue 2.6 allows for conditional event binding.
The text was updated successfully, but these errors were encountered: