The Majesty of Vue.js 2
The Majesty of Vue.js 2
About the Book
TL;DR: This title is the updated version of The Majesty of Vue.js, which sold over 700 copies, and was considered one of the first and top learning resources for the Vue.js framework. The book will be constantly updated to keep up with Vue.js 2 changes and new chapters will be added for a long time.
This book is addressed to anyone interested in learning Vue.js. It is useful for developers who are new to Vue.js as well as those who already use Vue.js and want to expand their knowledge. It is also helpful for developers who are looking to migrate to Vue.js 2.
A percentage (20%) of book earnings will be donated to Evan You to support the excellent work he's doing with the Vue framework.
If you are looking for more advanced topics like Vuex, Firebase, etc, check out Vue School.
This book will guide you through the path of the rapidly spreading Javascript Framework called Vue.js!
Some time ago, we started a new project based on Laravel and Vue.js. After thoroughly reading Vue.js' guide and a few tutorials, we discovered a lack of resources about Vue.js around the web. During the development of our project, we gained a lot of experience, so we came up with the idea to write this book in order to share our acquired knowledge with the world. Now that Vue.js 2 is out we decided it was time to update our book by publishing a second version where all examples and their relative contents are rewritten.
The book is written in an informal, intuitive, and easy-to-follow format, wherein all examples are appropriately detailed enough to provide adequate guidance to everyone. We’ll start with the very basics and through many examples, we’ll cover the most significant features of Vue.js 2.
The best way to learn code is to write code, so we have prepared one exercise at the end of most chapters for you to solve and actually test yourself on what you have learned. We have also updated the exercises and solutions for Vue 2, and strongly recommend you to try as much as possible to solve them in order to gain a better understanding of Vue.js.
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.
Who is this book for
Everyone who has spent time to learn modern web development has seen Bootstrap, Javascript, and many Javascript frameworks.
This book is for anyone interested in learning a lightweight and simple Javascript framework.
No excessive knowledge is required, though it would be good to be familiar with HTML and Javascript. If you don't know what the difference is between a string and an object, maybe you need to do some digging first.
This book is also useful for any reader who already know their way around Vue.js and want to expand their knowledge.
About the Contributors

Editor
Eugenia is an English teacher. She works as a translator and her main field is literature. However, she is challenged by all kinds of books. In her free time she likes to make subtitles for TV-series.
Table of Contents
-
Introduction
-
About Vue.js
- Vue.js Overview
- What people say about Vue.js
-
Comparison with Other Frameworks
- Angular 1
- Angular 2
- React
- Ember
- Polymer
- Riot
-
Welcome
- About the Book
- Who is this Book for
- Get In Touch
- Homework
- Sample Code
- Errata
- Conventions
-
About Vue.js
-
I Vue.js Fundamentals
-
1. Install Vue.js
-
1.1 Standalone Version
- 1.1.1 Download from vuejs.org
- 1.1.2 Include from CDN
- 1.2 Download using NPM
- 1.3 Download using Bower
-
1.1 Standalone Version
-
2. Getting Started
- 2.1 Hello World
- 2.2 Two-way Binding
- 2.3 Comparison with jQuery.
- 2.4 Homework
-
3. A Flavor of Directives.
- 3.1 v-show
-
3.2 v-if
- 3.2.1 Template v-if
- 3.3 v-else
- 3.4 v-if vs. v-show
- 3.5 Homework
-
4. List Rendering
- 4.1 Install & Use Bootstrap
-
4.2 v-for
- 4.2.1 Range v-for
-
4.3 Array Rendering
- 4.3.1 Loop Through an Array
- 4.3.2 Loop Through an Array of Objects
- 4.4 Object v-for
- 4.5 Homework
-
5. Interactivity
-
5.1 Event Handling
- 5.1.1 Handling Events Inline
- 5.1.2 Handling Events using Methods
-
5.1.3 Shorthand for
v-on
- 5.2 Event Modifiers
- 5.3 Key Modifiers
- 5.4 Computed Properties
- 5.5 Homework
-
5.1 Event Handling
-
6. Filters
-
6.1 Filtered Results
- 6.1.1 Using Computed Properties
- 6.2 Ordered Results
- 6.3 Custom Filters
- 6.4 Utility Libraries
- 6.5 Homework
-
6.1 Filtered Results
-
7. Components
- 7.1 What are Components?
- 7.2 Using Components
- 7.3 Templates
- 7.4 Properties
- 7.5 Reusability
- 7.6 Altogether
- 7.7 Homework
-
8. Custom Events
-
8.1 Emit and Listen
- 8.1.1 Lifecycle Hooks
- 8.2 Parent-Child Communication
- 8.3 Passing Arguments
- 8.4 Non Parent-Child Communication
- 8.5 Removing Event Listeners
- 8.6 Back to stories
- 8.7 Homework
-
8.1 Emit and Listen
-
9. Class and Style Bindings
-
9.1 Class binding
- 9.1.1 Object Syntax
- 9.1.2 Array Syntax
-
9.2 Style binding
- 9.2.1 Object Syntax
- 9.2.2 Array Syntax
- 9.3 Bindings in Action
- 9.4 Homework
-
9.1 Class binding
-
1. Install Vue.js
-
II Consuming an API
-
10. Preface
- 10.1 CRUD
-
10.2 API
- 10.2.1 Download Book’s Code
- 10.2.2 API Endpoints
-
11. Working with real data
- 11.1 Get Data Asynchronous
- 11.2 Refactoring
- 11.3 Update Data
- 11.4 Delete Data
-
12. HTTP Clients
- 12.1 Introduction
- 12.2 Vue-resource
- 12.3 Axios
- 12.4 Integrating axios
-
12.5 Enhancing Functionality
- 12.5.1 Edit Stories
- 12.5.2 Create New Stories
- 12.5.3 Store & Update Unit
- 12.6 JavaScript File
- 12.7 Source Code
-
12.8 Homework
- 12.8.1 Preface
- 12.8.2 API Endpoints
- 12.8.3 Your Code
-
13. Pagination
- 13.1 Implementation
- 13.2 Pagination Links
- 13.3 Homework
-
10. Preface
-
III Building Large-Scale Applications
-
14. ECMAScript 6
-
14.1 Introduction
- 14.1.1 Compatibility
-
14.2 Variable Declarations
- 14.2.1 Let Declarations
- 14.2.2 Constant Declarations
- 14.3 Arrow Functions
- 14.4 Modules
- 14.5 Classes
- 14.6 Default Parameter Values
- 14.7 Template literals
-
14.1 Introduction
-
15. Advanced Workflow
-
15.1 Compiling ES6 with Babel
- 15.1.1 Installation
- 15.1.2 Configuration
- 15.1.3 Build alias
- 15.1.4 Usage
- 15.1.5 Homework
-
15.2 Workflow Automation with Gulp
- 15.2.1 Task Runners
- 15.2.2 Installation
- 15.2.3 Usage
- 15.2.4 Watch
- 15.2.5 Homework
-
15.3 Module Bundling with Webpack
- 15.3.1 Module Bundlers
- 15.3.2 Webpack
- 15.3.3 Installation
- 15.3.4 Usage
- 15.3.5 Automation
- 15.4 Summary
-
15.1 Compiling ES6 with Babel
-
16. Working with Single File Components
-
16.1 The
vue-cli
- 16.1.1 Vue’s Templates
- 16.1.2 Installation
- 16.1.3 Usage
-
16.2 Webpack Template
- 16.2.1 Project Structure
- 16.2.2 index.html
- 16.2.3 Hello.vue
- 16.2.4 App.vue
- 16.2.5 main.js
-
16.3 Forming
.vue
Files- 16.3.1 Nested Components
-
16.1 The
-
17. Eliminating Duplicate State
- 17.1 Sharing with Properties
- 17.2 Global Store
-
18. Swapping Components
-
18.1 Dynamic Components
-
18.1.1 The
is
special attribute - 18.1.2 Navigation
-
18.1.1 The
-
18.1 Dynamic Components
-
19. Vue Router
- 19.1 Installation
- 19.2 Usage
- 19.3 Named Routes
- 19.4 History mode
- 19.5 Nested routes
-
19.6 Auto-CSS active class
- 19.6.1 Custom Active Class
- 19.7 Route Object
- 19.8 Dynamic Segments
- 19.9 Route Alias
- 19.10 Programmatic Navigation
-
19.11 Transitions
- 19.11.1 Introduction
- 19.11.2 Usage
- 19.11.3 3rd-party CSS animations
- 19.12 Navigation Guards
- 19.13 Homework
- 20. Closing Thoughts
-
21. Further Learning
- 21.1 Tutorials
- 21.2 Videos
- 21.3 Books
- 21.4 Open source projects
- 21.5 Awesome Vue
-
14. ECMAScript 6
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earned$12,307,240writing, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Top Books
OpenIntro Statistics
David Diez, Christopher Barr, Mine Cetinkaya-Rundel, and OpenIntroA complete foundation for Statistics, also serving as a foundation for Data Science.
Leanpub revenue supports OpenIntro (US-based nonprofit) so we can provide free desk copies to teachers interested in using OpenIntro Statistics in the classroom and expand the project to support free textbooks in other subjects.
More resources: openintro.org.
Personal Finance
Jason AndersonThis textbook provides an in-depth analysis on personal finance that is both practical and straightforward in its approach. It has been written in such a way that the readers can gain knowledge without getting overwhelmed by the technical terms. Suitable for both beginners and advanced learners.
Getting to Know IntelliJ IDEA
Trisha Gee and Helen ScottIf we treat our IDE as a text editor, we are doing ourselves a disservice. Using a combination of tutorials and a questions-and-answers approach, Getting to Know IntelliJ IDEA will help you find ways to use IntelliJ IDEA that enable you to work comfortably and productively as a professional developer.
R Programming for Data Science
Roger D. PengThis book brings the fundamentals of R programming to you, using the same material developed as part of the industry-leading Johns Hopkins Data Science Specialization. The skills taught in this book will lay the foundation for you to begin your journey learning data science. Printed copies of this book are available through Lulu.
C++20 - The Complete Guide
Nicolai M. JosuttisAll new language and library features of C++20 (for those who know previous C++ versions).
The book presents all new language and library features of C++20. Learn how this impacts day-to-day programming, to benefit in practice, to combine new features, and to avoid all new traps.
Buy early, pay less, free updates.
Other books:
Mastering STM32 - Second Edition
Carmine NovielloWith more than 1200 microcontrollers, STM32 is probably the most complete ARM Cortex-M platform on the market. This book aims to be the most complete guide around introducing the reader to this exciting MCU portfolio from ST Microelectronics and its official CubeHAL and STM32CubeIDE development environment.
Stats One
William FooteMachine Learning Q and AI
Sebastian Raschka, PhDHave you recently completed a machine learning or deep learning course and wondered what to learn next? With 30 questions and answers on key concepts in machine learning and AI, this book provides bite-sized bits of knowledge for your journey to becoming a machine learning expert.
Ansible for DevOps
Jeff GeerlingAnsible is a simple, but powerful, server and configuration management tool. Learn to use Ansible effectively, whether you manage one server—or thousands.
Gradual Modularization for Ruby and Rails
Stephan HagemannGet yourself a new tool to manage your Rails application and your growing engineering organization! Prevent the ball-of-mud (and fix it!). Go for microservices or SOA if it makes sense not just because you don't have any other tool. Do all this through a low-overhead tool: packages. Enable better conversations to make practical changes today.
Top Bundles
- #1
Software Architecture
2 Books
"Software Architecture for Developers" is a practical and pragmatic guide to modern, lightweight software architecture, specifically aimed at developers. You'll learn:The essence of software architecture.Why the software architecture role should include coding, coaching and collaboration.The things that you really need to think about before... - #2
CCIE Service Provider Ultimate Study Bundle
2 Books
Piotr Jablonski, Lukasz Bromirski, and Nick Russo have joined forces to deliver the only CCIE Service Provider training resource you'll ever need. This bundle contains a detailed and challenging collection of workbook labs, plus an extensively detailed technical reference guide. All of us have earned the CCIE Service Provider certification... - #3
1500 QUIZ COMMENTATI (3 libri)
3 Books
Tre libri dei QUIZ MMG Commentati al prezzo di DUE! I QUIZ dei concorsi ufficiali di Medicina Generale relativi agli anni: 2000-2001-2003-2012-2013-2014-2015-2016-2017-2018-2019-2020-2021 +100 inediti Raccolti in unico bundle per aiutarvi nello studio e nella preparazione al concorso. All'interno di ogni libro i quiz sono stati suddivisi per... - #4
Pattern-Oriented Memory Forensics and Malware Detection
2 Books
This training bundle for security engineers and researchers, malware and memory forensics analysts includes two accelerated training courses for Windows memory dump analysis using WinDbg. It is also useful for technical support and escalation engineers who analyze memory dumps from complex software environments and need to check for possible... - #5
Practical FP in Scala + Functional event-driven architecture
2 Books
Practical FP in Scala (A hands-on approach) & Functional event-driven architecture, aka FEDA, (Powered by Scala 3), together as a bundle! The content of PFP in Scala is a requirement to understand FEDA so why not take advantage of this bundle!? - #7
Linux Administration Complet
4 Books
Ce lot comprend les quatre volumes du Guide Linux Administration :Linux Administration, Volume 1, Administration fondamentale : Guide pratique de préparation aux examens de certification LPIC 1, Linux Essentials, RHCSA et LFCS. Administration fondamentale. Introduction à Linux. Le Shell. Traitement du texte. Arborescence de fichiers. Sécurité... - #9
Development and Deployment of Multiplayer Online Games, Part ARCH. Architecture (Vol. I-III)
3 Books
What's the Big Idea? The idea behind this book is to summarize the body of knowledge that already exists on multiplayer games but is not available in one single place.And quite a fewof the issues discussed within this series (planned as three nine volumes ~300 pages each), while known in the industry, have not been published at all (except for... - #10
Modern C++ Collection
3 Books
Get All about Modern C++C++ Standard Library, including C++20Concurrency with Modern C++, including C++20C++20Each book has about 200 complete code examples. Updates are included. When I update one of the books, you immediately get the updated bundle. You can expect significant updates to each new C++ standard (C++23, C++26, .. ) and also...