Possible to x-bind multiple attributes with object? #1541
-
Is there a way to bind multiple attributes using an object? So something like compiles to:
I assume its not supported since my attempts show Is there plans to add this support or is there a current/alternative way to accomplish this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Would be shorter to do it like: <span :drink="drink" :food="food">...</span> Is the intent to pass in an object literal? I think a better feature idea would be to auto bind if no expression is passed in, so you could write: <div x-data="{ drink: 'soda', food: 'pizza' }">
<span :drink :food>...</span>
</div> But after typing that out and looking at the preview, I don't necessarily like it. Feels more natural to me to keep it explicit. |
Beta Was this translation helpful? Give feedback.
Would be shorter to do it like:
Is the intent to pass in an object literal?
I think a better feature idea would be to auto bind if no expression is passed in, so you could write:
But after typing that out and looking at the preview, I don't necessarily like it. Feels more natural to me to keep it explicit.