Exercises for chapter 3

Exercise 1

When we were rewriting the shopping list application using simple components, we lost the application's functionality. The exercise suggests using an events emitting system in order to bring the functionality back.

The code we ended up with in this section was looking similar to what is in the chapter3/vue-shopping-list-simple-components folder.

Why doesn't it work? Check the devtools error console. It states the following:

[Vue warn]: Property or method "addItem" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option.
(found in component <add-item-component>)

Aha! This happens because inside add-item-template we are calling the addItem method ...

Get Learning Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.