Whenever I input a value into the 'temp_dollars' model and use a watch property to filter it, the input only retains the first 3 characters and resets.
For instance: When I type 123, The model value remains as 123. But when I type 1234, It changes to 0.
Vue.filter('to_currency', (val) => {
let string = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'PHP' }).format(val).toString()
return string.substr(4, string.length - 7)
})
watch: {
temp_dollars (val) {
this.temp_dollars = this.$options.filters.to_currency(val)
console.log(this.temp_dollars)
console.log(this.$options.filters.to_currency(val))
}
}
I expected that any input in the text field would automatically be formatted so that 1234 appears as 1,234.
** UPDATE **
This is my Home.vue