Forum

VUE3 - format numbe...
 
Notifications
Clear all

VUE3 - format number with dots

1 Posty
1 Users
0 Reactions
529 Widok
0
Topic starter

example

1 Answer
0
Topic starter

1. edit app.js

2. after vue initialization ( app variable) add this global filter

app.config.globalProperties.$filters = {
    formatNumber(number) {
        return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
    }
}

3. then in any component use this filter

 <span class="text-success">{{ $filters.formatNumber(this.bigNumber) }} </span>

This post was modified 2 lata temu by mrmucha

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: