Published 9 months ago by Kunzilla
Hi, i've created a gallery with vue and the components. I have a component and a component. There can be one or more elements. So, how can i access the "other" photo within the current photo element to "push" it into the (update)?
I've readed some articles about siblings, but i've no idea how to implement that in vuejs.
Hope anyone can help.
thanks for your answer. I just want to know "how" can i create a vuejs gallery with next / prev buttons to switch between the photos. My solution doesn't has these functions and in want to know how this can work. Thats the reason, i've post no codes or something. I'll rebuild the entire component.
ok. so a photo is like a photo-component?
so you might have:
and when you click on prev, or next, you see the previous or next photo?
if that sounds correct then its dead simple.
your parent component: photos will control previous and next, right? and it has the entire list of photos. and the photos component should have like a property called say: activePhotoIndex; so all you have to do is on clicking prev or next. is basically say. activePhotoIndex-- or activePhotoIndex++.
and when that is done, you just set the say the show property on all photos to false, and then set the show property for the matching photo by index to true.