Vue from Scratch
$14.99
Minimum price
$29.99
Suggested price

Vue from Scratch

A friendly guide for absolute beginners

About the Book

In this no fluff book, we dive straight in to building apps in Vue.

In chapter 1, we build the smallest possible Vue app, and get to know about:

* How to mount a Vue app

* String interpolation and data in HTML

* Adding a Vue instance and its options object

Once we've learned the very basics of how Vue is put together, we build a simple todo app in Vue 2.6, in chapter 2. Through the building of this app, we learn new concepts and build on the existing ones:

* Using the v-bind directive to connect Vue data to HTML attributes

* Handling button clicks with v-on:click

* Handling input events with v-on:input , v-on:keyup , v-on:keydown

* Handling more than one keypress event

* Preventing default behavior with event modifiers

* Modelling our app’s data

* Using the v-for directive to loop over Vue’s data arrays

* Preventing page reload on the form element

* Adding a toggle button with text and style updates

* Mounting and unmounting HTML elements with v-if and v-else

* Binding a CSS class in HTML to our Vue instance’s data option and showing this CSS class

conditionally

* Utilizing confirm popups in our apps

In Chapter 3, we introduce Vue CLI, and cover the following topics:

* How to install Vue on our machine,

* How to build a new Vue app using Vue CLI,

* How to serve our boilerplate Vue app in the browser,

* We inspected all the files and folders in the boilerplate Vue app that we installed using the

Vue CLI, and we discuss what they do and how they fit together

In Chapter 4, we have a sort of a revision of concepts from Chapters 1 and 2, but this time covered through the lens of working with Vue CLI, including:

* How to add a child component to our project

* How to interpolate string values from the data option of our Vue instance

* How to randomly pick and return string values from a method in the methods option of our

Vue instance, and interpolate that value in our single-file component’s template section

* How to bind a Vue instance’s data as a value of a template’s HTML attribute

* We also go through each file and folder in the starter app and describe why it's there and how it works

In Chapter 5, we learn about single-file components in a Vue app:

* Adding children components

* Revising interpolation (this time, in SFCs)

* Templating with values returned from methods

In Chapter 6, we discuss data flows in a Vue app:

* Sending data from the parent component to a child component

* Sending data from the child component to a parent component

* Emitting events with additional data

* We practice components' communication by building another Vue app

* We cover prop-related issues, such as naming conventions, using props in methods, fixing prop errors, passing props as various data types (prop binding)

In Chapter 7, we integrate a linting tool, ESLint, and a library, Bootstrap Vue, with our Vue CLI-powered Vue apps

* Revision of basic concepts: installing Vue, preparing VS Code to use it, installing the boilerplate Vue.js app with Vue CLI, removing redundant code from the starter app

* Setting up ESLint to work with Vue.js

* Styling our app with BootstrapVue

* Adding Vue Chrome extension

* Restarting our app (dealing with some weird errors)

In Chapter 8, we build the todo app again, this time with Vue CLI. This serves a double purpose:

* We revise all the concepts needed to build a todo app

* This chapter is a practical example on converting a non-Vue CLI app to a Vue CLI SFC Vue app. The insights you'll gain here are very valuable for a new Vue developer

In Chapter 9, another hands-on chapter, we continue working with the app we've built in Chapter 8, but this time we demo how to split a single file component into a component and a sub-component. We show the practical implementation of one-way data flow approach on an app that we're now quite familiar with, which helps us keep focus on understanding how to make our Vue apps more modular.

In Chapter 10, we "back-fill" our knowledge with some basic concepts that we've skipped in earlier chapters.

About the Author

Ajdin Imsirovic
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses (way back in 2015) on the subject of web design and web development. 

Before self-publishing books on Leanpub, he authored four books on front-end development for Packt Publishing:

  1. Vue CLI 3 Quick Start Guide (Build and maintain Vue.js applications quickly with the standard CLI), May 2019
  2. Vue.js Quick Start Guide (Learn how to build amazing and complex reactive web applications easily using Vue.js), October 2018
  3. Elm Web Development (An introductory guide to building functional web apps using Elm), March 2018
  4. Bootstrap 4 Cookbook (Over 75 recipes to help you build elegant and responsive web applications with Bootstrap 4), June 2017

Additionally, he's published a number of books on the Leanpub platform, specifically:

  1. A Better Way to Learn JavaScript - The Basics: https://bit.ly/abwtljs1
  2. A Better Way to Learn JavaScript - Built-in Objects: https://bit.ly/abwtljs2
  3. A Better Way to Learn JavaScript - Useful Snippets: https://bit.ly/abwtljs3
  4. A Better Way to Learn JavaScript - Mini Apps: https://bit.ly/abwtljs4
  5. A Better Way to Learn JavaScript - Advanced JavaScript: https://bit.ly/abwtljs5
  6. Angular From Scratch: https://bit.ly/ai-afs
  7. Vue.js From Scratch: https://bit.ly/ai-vfs
  8. React from Scratch: https://leanpub.com/react-from-scratch
  9. Building Amazing Layouts - Learn the Basics of HTML5, CSS3, and Bootstrap 5: https://bit.ly/bldamzlyts1
  10. Building Amazing Layouts - Bootstrap 5 Layouts in Depth: https://bit.ly/bldamzlyts2

Table of Contents

  • Chapter 1: The absolute basics
    • The smallest possible Vue.js app
    • String interpolation in Vue
    • Data in HTML
    • Adding a Vue instance
    • A Vue instance’s options object
    • A Vue instance’s options object’s data option
    • Other options in the Vue instance’s options object
    • Summary
  • Chapter 2: Building a todo app in Vue
    • Adding the static HTML
    • Adding a Vue instance
    • Adding a heading with Vue
    • Letting Vue control the input’s placeholder string
    • Handling button clicks with Vue
    • Handling input events with Vue
    • Handling keypress events with Vue
    • Handling more than one keypress event with Vue
    • Preventing default behavior with event modifiers
    • Modelling our todo item data
    • Vue’s version of a for loop (in HTML!)
    • Adding ordinal numbers using the v-for directive
    • Adding a new todo entry using two-way data binding
    • Emitting input events
    • Implementing two-way data binding in our todo app
    • Two-way binding shorthand syntax with v-model
    • Updating the list of todos in our unordered list
    • Preventing page reload on the form element
    • Clearing all todos
    • Adding a completed toggle button to each todo
    • Using a v-if to mount HTML elements conditionally
    • Erasing single todos
    • Warn the user with a browser confirm popup
    • Clear the input field whenever a user adds a todo
    • Let’s review the full code of our todo app
    • Summary
  • Chapter 3: Convert a static HTML page to Vue
    • Inspecting the source of our customized HTML layout
    • Importing Vue and mounting it in the DOM
    • Mounting a new instance of Vue
    • Adding multiple Vue instances to our HTML layout
    • Passing data to the cards section
    • Avoiding the repetition with v-for
    • Adding a bit more interactivity
    • Affecting data in one Vue instance from another Vue instance
    • Adding Bootstrap background classes
    • Binding the class attribute to a method call
    • Conclusion
  • Chapter 4: Build a Vue project with Vue CLI
    • Installing Vue CLI
    • Build a new project quickly with Vue CLI
    • Review the structure of our app
    • The node_modules folder
    • The public folder
    • The src folder
    • Stand-alone files at the very root of our Vue app
    • Conclusion
  • Chapter 5: Child components, data interpolation, and single file components
    • Introduction
    • 1. Adding children components
    • 2. Templating: Interpolating values stored in the data option
    • 3. Templating: Interpolating values returned from the methods option
    • Remember: We can’t interpolate strings inside HTML attributes
    • Conclusion
  • Chapter 6: Data flows in a Vue app
    • 1. What is a prop?
    • 2. Sending data from the parent component to a child component
    • 3. Sending data from the child component to a parent component
    • 4. Emitting events with additional data
    • 5. Practice: A message-passing app
    • 6. Prop names as kebab-case or as lowerCamelCase?
    • 7. Using props in methods
    • 8. Fixing the “Avoid mutating a prop directly” error
    • 9. Giving more information about our props with nested objects
    • 10. Passing props as data types other than “string”, and binding props with v-bind
    • 11. Making props more dynamic with v-bind and v-for
    • 12. Practicing the passing of data with emitted custom events
    • 13. Conclusion
    • 14. Summary
  • Chapter 7: Using Vue CLI with ES Lint and Bootstrap-Vue
    • 1. Renaming the HelloWorld component to the CaloryCounter component
    • 2. Adding and displaying data inside the CalorieCounter.vue component
    • 3. Setting up ESLint to work with Vue.js
    • 4. Styling our app with BootstrapVue
    • 5. Adding Vue Chrome extension
    • 6. Adding a navigation component to our app
    • 7. Restarting our app
    • Summary
  • Chapter 8: Building the Todo app again, this time with Vue CLI
    • Prepping a brand new Vue app for Bootstrap-Vue
    • 3. Add BootstrapVue to the app
    • 4. Adding the form-input component
    • Adding the button component
    • Adding the clear all button
    • Adding click events to buttons
    • Displaying the todos array
    • Adding the method to delete a single todo
    • Toggling styles
  • Chapter 9: Splitting a Vue app into sub-components
    • Splitting the TodoForm.vue code
    • Conclusion
  • Chapter 10: Other important concepts for Vue.js beginners
    • 1. Vue-specific shorthand syntax
    • 2. Using the emits option
    • 3. Slots and named slots
    • 4. Methods, computed properties, and watchers
    • 6. The v-once directive
    • 7. The v-html directive
    • 8. The v-show directive
    • 9. The life-cycle of a Vue component
    • 10. A Vue component’s life-cycle hooks
    • 11. Accessing DOM nodes using the Vue-specific HTML ref attribute
    • Conclusion
  • Chapter 11: Appendix A, the starter app
    • 1. Installing Vue.js
    • 2. Preparing VS Code for Vue
    • 3. Installing the boilerplate Vue.js app with Vue CLI
    • 4. Removing redundant code from our boilerplate Vue.js app

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.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

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 earnedover $13 millionwriting, 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

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub