[Vuejs]-Disable Submit button if the form fields' values have not changed in Vue/Nuxt

3👍

for object value, add a deep in watch, also, you need lodash.isEqual() to compare if two objects are equal

import _ from 'lodash';

...
    watch: {
      form: {
        handler(value){
          if(value) {
            this.changed = !_.isEqual(value, this.actual);
          }
        },
        deep: true,
      }
    },
...

0👍

Try to use @change="onChangeFn" or v-on:change="onChangeFn" on

methods: {
  onChangeFn () {
    this.changed = true
  }
}

Leave a comment