4 ms·
Congrats on the launch! Looks really interesting. I'm looking through the documentation and am having trouble understanding the slots example: https://nuejs.or
by theogravity 3y ago
Congrats on the launch! Looks really interesting. I'm looking through the documentation and am having trouble understanding the slots example:
https://nuejs.org/docs/nuejs/component-basics.html#slots https://nuejs.org/docs/nuejs/component-basics.html#slots
I'm unable to see the relationship between the <slot /> tag and the looped content in the 2nd code snippet. Can you clarify that in the documentation?
Edit: I think it would have made more sense if you included the @name="media-object" attribute in the first snippet.
- SparkyMcUnicorn 3y agoIt appears to be similar to Vue. The first snippet is the <media-object> component, and the second snippet is using the component. Everything inside the component tag goes into the slot.
- theogravity 3y agoI'm from a non-vue audience, so the context would be lost on someone like me.
- tipiirai 3y agoCan you clarify? Not sure I understand what you mean.
- theogravity 3y agoMy background is React, and I have no Vue experience at all. I only figured it out by looking at the previous section's code before slots to see that attribute and noticed that the slots example first snippet was missing the attribute I mentioned that would connect the pieces together
- tipiirai 3y agoThank you! The slot syntax is borrowed from Vue. The difference is that there can be only one slot, and not multiple named slots. I can see that the slots example needs improvement and more detail. I'll make it shine because slot is such an important feature and helps you build reusable code. I'll work on the docs as a whole, now that I'm getting this valuable feedback from here.
- tinco 3y agoEvery slot system I've ever seen eventually implemented multiple named slots. Often after first only supporting one slot, then multiple unnamed slot and then finally the whole shebang. Why go through that whole progress again with Nue? Or do you foresee some other way of doing highly customizable components?