[Vuejs]-How to disable v-model input in Vue from mutating

0๐Ÿ‘

โœ…

If Iโ€™m reading this correctly, the problem is that you are modifying orderSize by using -=, which will show up in the input.

If you want to avoid this, then first copy the value of orderSize to a new variable, e.g.:

// Copy the variable
let size = this.orderSize
for (...){
  if (...) {
    size -= coinArray[i][0]*coinArray[i][1];
  } else {
     return sum1+size/parseFloat(coinArray[i][0]);
  }

(I have removed unrelated code, and contents of if/for for clarity).

๐Ÿ‘คmatch

Leave a comment