[Vuejs]-How to make blur not replacing value on event with it previous value

0👍

Your problem is that you are setting the value of the element and not changing the value of the bounded variable which you should do.
so when vue "refreshes" it updates the input

do this instead

<b-input
    v-model="ownerProps.approver2ExtraCost"
    @blur="onClick(2)"
    class="inputBuefy"
  ></b-input>
</div>
<b-input
    class="inputBuefy"
    @blur="onClick(3)"
    v-model="ownerProps.approver3ExtraCost"
  ></b-input>
</div>

and change your function to

onClick(id) {
  if (id === 2) ownerProps.approver2ExtraCost = "dfg";
  if (id === 3) ownerProps.approver3ExtraCost = "dfg";
}

you should ideally have those elements in a array instead and send the index of what you want to change

Leave a comment