title: Single function for multiple v-model in vue.js
body: <p>Is it possible to get the more than one v-model value to one common function.
  In my case, input validation for the multiple fields using common function inside the method in vue script.</p>
  
  <pre><code>&lt;input type="number" v-model="field1" @keypress="onlyTwoDecimal" &gt;
  &lt;input type="number" v-model="field2"@keypress="onlyTwoDecimal" &gt;&lt;input type="number" v-model="field2" @keypress="onlyTwoDecimal" 
  
  &lt;script&gt;......    ....    method:{onlyTwoDecimal ($event) {  let keyCode = ($event.keyCode ? $event.keyCode : $event.which);
  
      // only allow number and one dot
      if ((keyCode &lt; 48 || keyCode &gt; 57) &amp;&amp; (keyCode !== 46 || this.field1.indexOf('.') != -1)) { // 46 is dot
       $event.preventDefault();
      }
  
      // restrict to 2 decimal places
      if(this.field1!=null &amp;&amp; this.field1.indexOf(".")&gt;-1 &amp;&amp; (this.field1.split('.')[1].length &gt; 1)){
      $event.preventDefault();
      }
    }
  </code></pre>
  
  <p>}
  </p>