From the course: Learning Vue.js

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Configuring custom events

Configuring custom events - Vue.js Tutorial

From the course: Learning Vue.js

Start my 1-month free trial

Configuring custom events

- [Instructor] In this video, we'll solve the problem of not being able to flip the card now that it's in its own separate component. One solution could be to set it up as a data property, just like we do with our route instance. Child components can also have their own data and it can be copied from props. So, we could set up a data property. We wouldn't use the name Flipped because that's already being used for the prop, but we can call it isFlipped, and then we could use Flipped as the initial value. And then, we could update our template to use isFlipped and just manipulate that value as necessary. But we'll be better off if we continue to let the parent have complete control over this property and that's so that we can make sure we're always resetting Flipped to false as we cycle through the cards in the parent component. We don't want both components to be able to change this value as that will get confusing to…

Contents