From d7c28437b63a92c953c853986115fa17e71ed559 Mon Sep 17 00:00:00 2001 From: AriaieBOY Date: Tue, 28 May 2024 18:29:53 +0330 Subject: [PATCH] fix issue #25 --- resources/views/currency-mask.blade.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/views/currency-mask.blade.php b/resources/views/currency-mask.blade.php index 8682d47..dab2f12 100644 --- a/resources/views/currency-mask.blade.php +++ b/resources/views/currency-mask.blade.php @@ -20,18 +20,21 @@ input:\$wire.{$applyStateBindingModifiers("\$entangle('{$statePath}')")}, masked:'', init(){ - \$nextTick(()=>this.masked = this.input?.toString().replaceAll('.','$decimalSeparator')); + \$nextTick(this.updateMasked()); \$watch('masked',()=>this.updateInput()); \$watch('input',()=>this.updateMasked()); }, updateMasked(){ + console.log('masked') + if(typeof Number(this.input) === 'number'){ - \$el.value = this.input?.toString().replaceAll('.','$decimalSeparator'); + this.masked = this.input?.toString().replaceAll('.','$decimalSeparator'); \$el.dispatchEvent(new Event('input')); } }, updateInput(){ - this.input = \$el.value?.replaceAll('$thousandSeparator','').replaceAll('$decimalSeparator','.'); + console.log('input') + this.input = this.masked?.replaceAll('$thousandSeparator','').replaceAll('$decimalSeparator','.'); } } JS;