Replies: 3 comments 5 replies
-
Thanks Martin, unfortunately Alpine doesn't give us a way fo define a new directive such as x-prop and this repo is a community project so we don't have control on what it's going to be included in core. |
Beta Was this translation helpful? Give feedback.
-
Hi Simone, thanks for you reply. I wasn't aware of the technical limitation that prevents adding new directives. Although I am aware that I could use Also the events I was thinking about would make more sense if they where bound similar to vue on the component like Thanks for taking the time to reply! |
Beta Was this translation helpful? Give feedback.
-
Hello! I'll share my approach for accessing data from x-for loops. Currently I'm using some wrapping element as middle man and keep iterated data globally in Spruce store. It looks like below:
The subcomponent gets data on initialization from the store by first obtaining it's ID and index from $el.parentNode. It's not the most elegant way. The biggest issue here is that subcomponent has to be aware that it's inside iteration. |
Beta Was this translation helpful? Give feedback.
-
Hi, I understand that alpine isn't Vue but I think it would be great if one could bind parent component properties via an attribute similar to
x-props="{someKey : propertyOfTheCurrentComponentData}"
and likewise call parent component's methods through something likex-on:click="$emit('nameOfParentComponentsMethod', someData)"
. I am sorry if this has been discussed ad nausea and I am unable to find the discussion. Is this worthwile or should I simply use Vue when I need such features?I initially posted this in the regular alpine discussion board but i feel it suites here better!
Beta Was this translation helpful? Give feedback.
All reactions