Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Vue.js 2

You're reading from   Learning Vue.js 2 Learn how to build amazing reactive web applications easily with Vue.js

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher Packt
ISBN-13 9781786469946
Length 334 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Olga Filipova Olga Filipova
Author Profile Icon Olga Filipova
Olga Filipova
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Going Shopping with Vue.js 2. Fundamentals ā€“ Installing and Using FREE CHAPTER 3. Components ā€“ Understanding and Using 4. Reactivity ā€“ Binding Data to Your Application 5. Vuex ā€“ Managing State in Your Application 6. Plugins ā€“ Building Your House with Your Own Bricks 7. Testing ā€“ Time to Test What We Have Done So Far! 8. Deploying ā€“ Time to Go Live! 9. What Is Next? A. Solutions to Exercises

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 which does not belong to this component. This method belongs to the parent component, and of course, the child component does not have access to it. What should we do? Let's emit events! We already know how to...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime