From 15f3f76ae203768c9b5a93f63f864d0fc04fc828 Mon Sep 17 00:00:00 2001 From: AriaieBOY Date: Thu, 30 May 2024 22:21:08 +0330 Subject: [PATCH] fix #31 --- resources/views/currency-mask.blade.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/views/currency-mask.blade.php b/resources/views/currency-mask.blade.php index f7b8df0..6ae7721 100644 --- a/resources/views/currency-mask.blade.php +++ b/resources/views/currency-mask.blade.php @@ -22,10 +22,13 @@ init(){ \$nextTick(this.updateMasked()); \$watch('masked',()=>this.updateInput()); + \$watch('input', () => this.updateMasked()); }, - updateMasked(){ + updateMasked(value, oldValue){ if(this.input !== undefined && typeof Number(this.input) === 'number') { - this.masked = this.input?.toString().replaceAll('.','$decimalSeparator'); + if(this.masked?.replaceAll('$thousandSeparator','').replaceAll('$decimalSeparator','.') != this.input){ + this.masked = this.input?.toString().replaceAll('.','$decimalSeparator'); + } } }, updateInput(){