vue-numeric
vue-numeric copied to clipboard
New input displays formatted value if focused too quickly
If you set the focus on a new vue-numeric input immediately after creating it, the input does not stay cleared, and will display the formatted value after a brief moment, as if it has lost focus.
I can see that in the mounted()
event, we're updating the value, then updating it again 500ms later. I don't want to attempt to fix this without understanding what the purpose of this delay is:
// In case of delayed props value.
setTimeout(() => {
this.process(this.valueNumber)
this.amount = this.format(this.valueNumber)
}, 500)
Expected Behavior
A new vue-numeric input, when focused immediately after being created, should remain focused and should remain cleared until the first blur event
Actual Behavior
If the new input is focused too quickly, the formatted value is displayed instead of remaining blank
Steps to Reproduce the Problem
- Create a new instance of vue-numeric
- Immediately set focus to the new input.
- Input correctly receives focus and contains no value
- Half a second later, the input sets it's value to $0.00 and retains focus
Specifications
- Plugin Version: 2.3.0
- Vue.js Version: 2.5.16
- Browser: Chrome
- OS: Windows 10