Search icon CANCEL
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
Building Forms with Vue.js

You're reading from   Building Forms with Vue.js Patterns for building and scaling complex forms with great UX

Arrow left icon
Product type Paperback
Published in Oct 2019
Publisher Packt
ISBN-13 9781839213335
Length 108 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Marina Mosti Hernandez Mosti Marina Mosti Hernandez Mosti
Author Profile Icon Marina Mosti Hernandez Mosti
Marina Mosti Hernandez Mosti
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Setting up the Demo Project FREE CHAPTER 2. A Form in its Simplest Form 3. Creating Reusable Form Components 4. Input Masks with v-mask 5. Input Validation with Vuelidate 6. Moving to a Global State with Vuex 7. Creating Schema-Driven Forms 8. Other Books You May Enjoy

Preparing the schema

Currently, our form (as previously stated) is hardcoded. The first step that is required to start making it a dynamic form is to remove the need to add BaseInput or BaseSelect directly to our App.vue file every time we need to add a new field. This implies that we are going to need to have some sort of organized structure, or schema, to represent what we are trying to accomplish for our form. Since we are using JavaScript, the most logical way to do this is with a JSON object format. This will make it easier later on when we want to take it a step further and have our mock API feed the information directly to our form.

For now, we will use a static schema. Let's create a data folder inside src, and inside of it, make a new schema.json file. We are going to populate our JSON file with some dummy data. I have chosen, for the sake of an example, to make...

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 €18.99/month. Cancel anytime