Skip to content

Commit 63db573

Browse files
Update src/components/NumberInput.vue
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent 1de2e44 commit 63db573

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/components/NumberInput.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,10 @@ watch(model, (newValue, oldValue) => {
256256
return;
257257
}
258258
259-
internalValue.value = `R$ ${newValue.replace('.', ',')}`;
259+
const parsed = parseFloat(newValue);
260+
internalValue.value = isNaN(parsed)
261+
? `R$ ${newValue.replace('.', ',')}`
262+
: parsed.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' });
260263
}, {immediate: true});
261264
262265
watch(internalValue, (value, oldValue) => {

0 commit comments

Comments
 (0)