Skip to content

Commit

Permalink
fix issue #25
Browse files Browse the repository at this point in the history
  • Loading branch information
ariaieboy committed May 28, 2024
1 parent a60a2cd commit d7c2843
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions resources/views/currency-mask.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d7c2843

Please sign in to comment.