1. 17
    Create and Manipulate State within a Vue Component by Defining Methods and Properties
    2m 27s

Create and Manipulate State within a Vue Component by Defining Methods and Properties

Share this video with your friends

Send Tweet

We'll see how we can add methods and properties to components, allowing us to keep the logic that controls our components together with the templates.

Our component receives tickets for the visitor to buy, we'll create a method in our component and bind it to a button that allows them to buy those tickets. In doing so, you'll notice that we can't change the value of the tickets that we received, it's immutable. To get around this we'll create a local variable in our component to update the display as tickets are purchased.