[Vuejs]-How to check v-model object value

0👍

You have to use value and @input like this:

<el-input :value="scope.cash | formatValue" @input="scope.cash= $event"></el-input>

Of course you have to write your own filter as described before:

filters: {
  formatValue: formatValue (data) {
    return data 
      ? data
      : 0
  }
},

0👍

Replace the element with <el-input v-model="{{ scope.cash | formatValue }}" />

Place this in the script tag above data

filters: {
  formatValue: formatValue (data) {
    return data?data:0
  }
},

You can use this filter for as many as key formatValue

Leave a comment