How to bind class to a result of a function ? #811
Replies: 2 comments 4 replies
-
Did that not work? |
Beta Was this translation helpful? Give feedback.
-
Yes it worked, but because in the doc it only says we should use object synthax and also coming from VueJS we should use computed properties to do so. So even if it works I'm not sure if it's the right way and if I'm not create an issue for future binding reactivity or something else... That's why I wanted to know the right way when you need complex computation for class binding. |
Beta Was this translation helpful? Give feedback.
-
Hi have a rotating cards system (3 in my case) and need to set a
is-current
class on the clicked card andis-previous
on the previous card andis-next
on the next card. But doing it with thex-bind:class={}
synthax it ends up being huge like this :Is there a way to extract this logic to a function and doing something like (not and object anymore) :
Beta Was this translation helpful? Give feedback.
All reactions