-
Notifications
You must be signed in to change notification settings - Fork 150
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
Adds a :properties directive #68
Conversation
Why: * This allows sending props down to the underlying components without having to redefine them all. This is just an experience on how it could work for html tags This change addresses the need by: * Adding a :props directive that for a component will take a map and add it to the props in the assigns as __dynamic_props__. If it is a tag, it will go over those __dynamic_props and add them as attributes.
* Slot already uses :props * On the html tag don't really need the value of the directive, but it's not registered as a directive otherwise. Might look into that later.
@zamith thanks a lot for the PR! I took I look at the code and also tried a couple of alternatives to simplify the implementation, however, my feeling is that the current way to handle directives is far from ideal. I'll put this PR on hold until I finish #15. It should become much easier to properly implement this feature after that. |
Yes, that would help a lot of the implementation, I think. In terms of the proposal for how to use it though, does it make sense or do you have other ideas? Also not a fan of not being able to call it |
I think the behaviour should be very similar. The one thing we need to decide is how the values should be overridden. For instance, if we have: <Component prop1="value1" :props={{ @some_props }} prop2="value2"/> and the value of What should be the behaviour? We have 3 options:
I believe the less confusing would be
I think we should call it |
Yup. Agree that What I meant is that I tried calling it |
Why:
having to redefine them all. This is just an experience on how it
could work for html tags
Related to #2
This change addresses the need by:
add it to the props in the assigns as
__dynamic_props__
. If it is a tag,it will go over those
__dynamic_props__
and add them as attributes.Notes:
not registered as a directive otherwise. Might look into that later.