[Vuejs]-How to properly use Veulidate along with vuex in vue 2

0👍

v-on directive accepts expression or callback function as event handler. Considring that click is a method, @click="click" and @click="click($event)" behave the same way, with the latter being explicit.

setNewEmployeeName; setName() is JS expression and it behaves like it would be evaluated outside the template; setNewEmployeeName is not called and is a no-op, while it should be provided with field value as an argument.

It’s a good practice to not distribute JS code between template and script parts of a component. Instead, it can be:

@input="setName"

and

setName(event){
  this.setNewEmployeeName(event.target.value);
  this.$v.newEmployeeName.$touch()
}

Leave a comment