N
Nuxt3mo ago
Klives

How to iterate over children of a component?

Hey, I would like to achieve something like this however, I've searched all over and haven't found anything that describes how this is achieved in Nuxt, I'd like to achieve something like this.

setup(props, context){
this.children.forEach(element => { console.log(element.horizontalGrids);
});
}

setup(props, context){
this.children.forEach(element => { console.log(element.horizontalGrids);
});
}
Thanks in advance
1 Reply
Jacek
Jacek3mo ago
Assuming you control the component you are trying to read, you can just add ref attribute, get the list of objects representing your components and read whatever is exposed outside. Demo Going through virtual component structure is advanced and quite painful. I did it once, or twice, but would not recommend.
Want results from more Discord servers?
Add your server