Is there any way I can add comma automatically in input type="number" field in vue js? This is my only way to automatically change the IME options in Microsoft and disallowing the user to input Japanese character.
<ui-textbox label="initial" v-model="initial_cost"
name="initial_cost"
v-validate="`numeric|decimal`"
type="number"
v-on:keydown="isNumber"
:maxlength = "18"
:enforceMaxlength="true"
value = 0.00
format="number"
></ui-textbox>
isNumber: function(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
var charval= String.fromCharCode(evt.keyCode);
console.log(typeof evt);
if((charCode >= 48 && charCode <= 57) || (charCode >= 96 && charCode <= 105) || charCode == 8 || charCode == 46 ||
charCode ==36 || charCode ==35){
return true;
}else{
return false;
}
so if I the user input 1000, display is 1,000, 10000 to 10,000 and so on. I've seen a solution like this problem here but it seems that he is using input type="text" field? Is there any way I can apply this to my type="number" field in vue?
type=textand then validate the number in the javascript I'm afraid. Please check this post. stackoverflow.com/questions/35315157/…. Also, in w3 specifications, they clearly state that this is up to the user agent. w3.org/TR/html50/forms.html#number-state-%28type=number%29type="number"and it didn't work ?