Events and Data Flow - sikaeducation/vue-curriculum GitHub Wiki
Lesson Objectives
- Create Vue components that manipulate state with events
Lesson Outline
- Start a new Vue app
- In
App.vue
, create a property in state called counter
and initialize it to 0
- Display the
counter
property in the template
- Add a button to
App.vue
- When the button is clicked, increment the
counter
property
- Move the
counter
property being displayed to a component called CounterDisplay.vue
- Pass the
count
state into CounterDisplay.vue
as props
- Move the button into a component called
CounterControl.vue
- Bubble the click event from
CounterControl.vue
to App.vue
- Add a
decrement
event to CounterControl.vue
Resources