Form in vuejs

You can use the v-model directive to create two-way data bindings on form input elements. It automatically picks the correct way to update the element based on the input type.

<template>

<form>
   <input type="text" id="name" v-model="signup.name" placeholder="Enter your name.." />
   <input type="email" id="email" v-model="signup.email" placeholder="Enter your email.." />
   <button type="button" id="submit" v-on:click="submitForm()">Submit</button>
</form>

</template>
<script>

   export default {
      name: "HeaderComponent",
      props: ['newArr'],
      methods: {
         submitForm(){
            console.log(this.signup);
         }
      },

      data() {
         return {
            signup : {
               name: '',
               email: ''
            }
         }

      }

      }

</script>

Leave a Reply