Skip to content

How can binding event by condition? #3134

Answered by sorvell
dbwodlf3 asked this question in Q&A
Discussion options

You must be logged in to vote

You can do this easily by putting the condition in the handler:

<button @click=${this.shouldHandleClick && this.handleClick}>...

See: https://lit.dev/playground/#gist=e1b79a1e5d0d492445cee0288f1fca4c

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@augustjk
Comment options

@justinfagnani
Comment options

@ynxtynxt
Comment options

Answer selected by sorvell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants