Book Image

The Majesty Of Vue.js

By : Alex Kyriakidis, Kostas Maniatis
Book Image

The Majesty Of Vue.js

By: Alex Kyriakidis, Kostas Maniatis

Overview of this book

<p>Vue.js is a library to build interactive web interfaces. The aim is to provide the benefits of reactive data binding and composable view components with an API that is as simple as possible.</p> <p>This book will teach you how to efficiently implement Vue.js in your projects. It starts with the fundamentals of Vue.js to building large-scale applications. You will find out what components, filters, methods, and computed properties are and how to use them to build robust applications.</p> <p>Further on, you will become familiar with ES6, single file components, module bundlers, and workflow automation. The best way to learn to code is to write it, so there’s an exercise at the end of most of the chapters for you to solve and actually test yourself on what you have learned. You can solve these in order to gain a better understanding of Vue.js.</p> <p>By the end of this book, you will be able to create fast front-end applications and increase the performance of your existing projects with Vue.js integration.</p>
Table of Contents (23 chapters)
The Majesty of Vue.js
Credits
About the Authors
www.PacktPub.com
Preface
2
Getting Started
8
Consuming an API – Preface
12
ECMAScript 6
15
Swapping Components
18
Closing Thoughts

Homework


This is the most difficult exercise so far, so make sure to put in use everything you have learned in this book. Create an array of 4 horse-drawn chariots. Each chariot has a "name" and a number of "horses" (from 1 to 4). Create a Component named chariot. The chariot Component should display the name of the chariot and the number of the horses it has. It also must have an action button. The button's text depends on the currently selected chariot.

More specifically, button's text should be:

  • Pick Chariot: Before the user has chosen any chariot

  • Dismiss Horses: When the chariot has less horses than the selected chariot

  • Hire Horses: When the chariot has more horses than the selected chariot

  • Riding!: When the chariot is the selected chariot (this button has to be disabled)

The user should be able to pick a chariot and then choose between any chariot he wants to.

Example scenario: User has chosen a chariot with 2 horses and its button says Riding!. A chariot with 3 horses has one more horse...