Let's figure a simple sum app. two inputs, a and b and a c result.
we have this markup
<div id="app">
<input v-model.number="v1">
<input v-model.number="v2">
{{v3}}
</div>
and this Vue script
var vm = new Vue ({
el: "#app",
data: {
a:0,
b:0,
},
computed: {
c:function(){
return this.a + this.b;
}
}
})
this works great except that I'm working with localized numbers. that means. using comma "," instead of dot "." and dot instead of comma .
entering number with decimal places confuses vue, and it are not able to make a correct sum.
What can I do in order to make VueJS understand localized number input and them make the correct sum?
for instance in pt-BR locale: 1.000,30 + 100,30 = 1.100,60