In VueJs, I need to be able to compute a quantity which depends on the order of the components in a table:
<mySlides> <componentTableOfContent></componentTableOfContent> <componentA my-title="First title" pages="5">Blabla</componentA> <componentB my-title="Second title" pages="2">Bleble</componentA> <componentC my-title="Third title" pages="4">Blibli</componentA> <mySlides>
Should produce something as following:
Table of content: - First title, pages 1-5 - Second title, pages 6-7 - Third title, pages 8-12 # First title, page 1 Blabla # Second title, page 6 Bleble # Third title, page 8 Blibli
Do you know how I could do that?
Note that I don't want to specify in each component its absolute position for the sake of maintainability. Ideally, the method should work irrespective of the time to load each component, and would get updated if some components are dynamically added.
EDIT I'm wondering if list of slots could not help with this task How to render a list of static content with Vue named slot? but if so I'm not yet sure to see how to use them in vue 3