F
F
fessss2021-09-06 16:21:13
Vue.js
fessss, 2021-09-06 16:21:13

"Address same as previous" method?

There is a huge form in which there are many fields of various addresses.

form {
  home: {
    address1: '',
    address2: '',
  },
  work: {
    address1: '',
    address2: '',
  },
}

And there is a layout of these fields with a checkbox, where when you click on the checkbox, the value of one address is written to the value of the second. But how to implement this business with a reusable method? Something like

this.form.home.address2 = this.form.home.address1

<v-checkbox @change="equalAddress(form.home.address1, form.home.address2)"/>

equalAddress(address1, address2) {
  address2 = address1
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question