Building Forms with Vue.js - Marina Mosti - E-Book

Building Forms with Vue.js E-Book

Marina Mosti

0,0
19,69 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Learn how to build dynamic schema-driven forms with Vue from scratch




Key Features



  • Understand the basics of form component composition


  • Scale and integrate your forms with libraries such as Vuex and Vuelidate


  • Convert any form into a self-generated schema-driven app



Book Description



Almost every web application and site out there handles user input in one way or another, from registration forms and log-in handling to registration and landing pages. Building Forms with Vue.js follows a step-by-step approach to help you create an efficient user interface (UI) and seamless user experience (UX) by building quick and easy-to-use forms.






You'll get off to a steady start by setting up the demo project. Next, you'll get to grips with component composition from creating reusable form components through to implementing the custom input components. To further help you develop a convenient user input experience, the book will show you how to enhance custom inputs with v-mask. As you progress, you'll get up to speed with using Vuelidate and Vuex to effectively integrate your forms. You'll learn how to create forms that use global state, reactive instant user input validation and input masking, along with ensuring that they are completely schema-driven and connected to your application's API. Every chapter builds on the concepts learned in the previous chapter, while also allowing you to skip ahead to the topics you're most interested in.






By the end of this book, you will have gained the skills you need to transform even the simplest form into a crafted user and developer experience with Vue.




What you will learn



  • Learn all about the basics of creating reusable form components with the Vue framework


  • Understand v-model and how it plays a role in form creation


  • Create forms that are completely powered and generated by a schema, either locally or from an API endpoint


  • Understand how Vuelidate allows for easy declarative validation of all your form's inputs with Vue's reactivity system


  • Connect your application with a Vuex-powered global state management


  • Use the v-mask library to enhance your inputs and improve user experience (UX)



Who this book is for



If you are a developer with basic Vue experience who wants to enhance your forms, then this book is for you. No previous experience with any of the libraries used in the book is required.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Seitenzahl: 108

Veröffentlichungsjahr: 2019

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Building Forms with Vue.js

 

 

 

 

 

 

Patterns for building and scaling complex forms with great UX

 

 

 

 

 

 

 

 

 

 

 

 

 

Marina Mosti

 

 

 

 

 

 

 

 

 

 

BIRMINGHAM - MUMBAI

Building Forms with Vue.js

Copyright © 2019 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Commissioning Editor:Pavan RamchandaniAcquisition Editor:Larissa PintoContent Development Editor:Aamir AhmedSenior Editor: Mohammed Yusuf ImaratwaleTechnical Editor:Jane DsouzaCopy Editor: Safis EditingProject Coordinator:Manthan PatelProofreader: Safis EditingIndexer:Tejal Daruwale SoniProduction Designer: Joshua Misquitta

First published: October 2019

Production reference: 1231019

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-83921-333-5

www.packt.com

  
 
 
 
 
 
  
  
 
 
 
 
 
 
  
 
To my friends Natalia, Damian, and Chris, without whom I wouldn't have got this far.
- Marina Mosti
 

Packt.com

Subscribe to our online digital library for full access to over 7,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Fully searchable for easy access to vital information

Copy and paste, print, and bookmark content

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. 

Foreword

I first became aware of Marina through her educational work, writing fun and accessible articles about Vue ranging from the very basics to advanced concepts such as object constancy and configuring Vue CLI. I later learned about her work on the Vuelidate team, building some of the most robust form libraries in the Vue ecosystem. Now I get to work with her directly as one of the first people I go to for help breaking down a difficult new concept for the Vue ecosystem.

I'm the one who recommended she write this book, as it's long overdue and she's the perfect person for the job. Building and maintaining complex forms in Vue is among the topics I get asked about the most, but comprehensive resources are still rare. Marina uses her expertise in this domain to provide the most approachable and complete introduction to the essential tools and strategies I've yet seen. It's a must-read for anyone who uses Vue, builds forms, and still has questions.

 

Chris Fritz, October 2019

Vue Team

Contributors

About the author

Marina Mosti is a full-stack web developer with over 13 years of experience in the field. She enjoys mentoring other women on JavaScript and her favorite framework, Vue, as well as writing articles and tutorials for the community.

She currently holds a position as Lead FE Developer at VoiceThread, and is the author of the FormVueLatte library as well as a member of the Vuelidate team. In her spare time, she enjoys playing bass, drums, and videogames.

About the reviewers

Natalia Tepluhina is a Vue.js core team member and a Senior Frontend Engineer at GitLab. She is a conference speaker and author of articles on different topics related to Vue.js. Thanks to these activities, Natalia has got the title of Google Developer Expert in Web Technologies.

 

Chris Fritz is an educator/developer hybrid and consultant who draws on his upbringing as a cultural mutt to help Vue devs around the world be happier in their work. He's most well known for his work on the Vue docs and Vue Enterprise Boilerplate, as well as speaking, leading workshops, and cohosting a weekly podcast called Views on Vue. When he's not working, he's probably reading speculative fiction, working out with lightsabers in virtual reality, frowning at puzzle games while he insists he's having fun—or even outside enjoying a hike with friends.

 

 

 

 

 

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Title Page

Copyright and Credits

Building Forms with Vue.js

Dedication

About Packt

Why subscribe?

Foreword

Contributors

About the author

About the reviewers

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Code in Action

Conventions used

Get in touch

Reviews

Setting up the Demo Project

Technical requirements

Installing Vue CLI onto our computer

Creating our new project

A quick look at the project structure

Summary

A Form in its Simplest Form

Technical requirements

Getting started using Bootstrap

Actually writing some code

Binding the inputs to local state

Submitting the form's data

Bringing in Axios

Summary

Creating Reusable Form Components

Technical requirements

Breaking down the form into components

Understanding v-model in custom components

Implementing a custom input component

One more time – with dropdowns!

Summary

Input Masks with v-mask

Technical requirements

Installing the v-mask library

Exploring the v-mask directive

Enhancing our custom inputs

Summary

Input Validation with Vuelidate

Technical requirements

Installing dependencies

Creating validation rules

Moving validation into our custom inputs

Adding the final touches

Summary

Moving to a Global State with Vuex

Technical requirements

Adding Vuex to our project

Creating the mock API endpoint

Creating the global state

Adding some mutations to our store

Lights, Vue, actions!

Vuelidate and Vuex

Summary 

Creating Schema-Driven Forms

Technical requirements

Exploring the starter kit

Preparing the schema

Loading the schema and creating a Renderer component

Dynamically binding the user's data

Creating a mock API

Loading the new API into the app

Translating the API into a working schema

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

Preface

Vue.js is one of the world's leading and fastest growing frameworks for frontend development. Its gentle learning curve and vibrant and helpful community have made it an easy choice for many new developers looking to harness the power of frontend frameworks. Additionally, its flexibility and power have made it an easy choice for advanced developers and companies to use it as their main tool for powerful, dynamic, and lean applications and websites.

In Building Forms with Vue.js, we will explore a specific part of frontend development—forms. We will journey together, from creating the most basic forms all the way through to understanding how a fully dynamic, schema-driven form works.

Who this book is for

Building Forms with Vue.js is aimed at frontend developers who have a basic understanding of the Vue.js framework and who want to understand how to better create powerful and reusable forms.

What this book covers

Chapter 1, Setting up the Demo Project, will guide you through setting up the base of the project that we will be building on throughout the book. It is recommended that you work through the book in the order of the chapters, as they build on the concepts learned in the previous ones. However, the completed code for each chapter will be provided at the beginning of each in case you want to skip forward.

Chapter 2, A Form in its Simplest Form, shows the basics of building a basic web form, and the process of connecting the inputs to your app's state. You will also learn about the basics of submitting the form, and using the Axios library to make asynchronous calls to the backend.

Chapter 3, Creating Reusable Form Components, will teach you how to break down a form into components that can be reused throughout your application. You will understand how the v-model directive works and how the main application and form can leverage these components.

Chapter 4, Input Masks with v-mask, touches upon using the v-mask library to allow for input masking to improve user experience. You will learn how to implement third-party plugins and how to incorporate them into your custom components.

Chapter 5, Input Validation with Vuelidate, walks you through the process of adding Vuelidate—a powerful form validation library—to your project, creating validation rules and applying them to your form, as well as how to incorporate it into your custom components.

Chapter 6, Moving to a Global State with Vuex, takes things a step further by transferring the current application's local state to a global state by leveraging the power of Vuex—the official global state management library and pattern. We will incorporate Vuelidate and our custom components into the mix.

Chapter 7, Creating Schema-Driven Forms, brings all the previous concepts together and walks you through the process of understanding and creating a renderer component that allows your application to be fully schema-driven. It will react to API changes provided by a mock API, as well as provide an explanation of how to generate a fully constructed form complete with data submission to the mock backend.

To get the most out of this book

In order for you to follow this book easily, I have to make some assumptions regarding some pre-existing knowledge on your end. Here's a checklist of the basic requirements you need in order to get the most out of this book:

You have used HTML, CSS, and Java

S

cript before and are comfortable creating basic web applications.

You are familiar with

console.log

statements and the general debugging of web apps in a browser such as Chrome.

Basic knowledge of Terminal commands. You should know how to navigate folders with the

cd

command at the very least.

You understand basic concepts of Vue, such as state, reactivity, interpolation, computed prop

erties, and 

methods. Make sure that you take a look at the

Essentials

part of the official guide for reference:

 

https://vuejs.org/v2/guide/

.

You have access to a computer and an internet connection to download and install the required libraries and project files

.

In the first chapter of this book, we will go over how to set up your project with an easy-to-follow step list.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

Log in or register at

www.packt.com

.

Select the

Support

tab.

Click on

Code Downloads

.

Enter the name of the book in the

Search

box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR/7-Zip for Windows

Zipeg/iZip/UnRarX for Mac

7-Zip/PeaZip for Linux