[Vuejs]-How should I copy part of content in form after clicking the button in Vue js

0👍

You can store a variable in data and use v-for in your form.

<form v-for="(form,index) in numberofForms" :key="index"
   @submit.prevent = "numberofForms++" >
  <b-form-input id="name" v-model="name" type="text" required/>
  ... other codes needs to copy

  <b-button type="submit">Save</b-button> 
</form>

export default {
...
data() {
 return {
  numberofForms: 1,
  }
 },
};

Leave a comment