File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ <template >
2+ <span >{{ localeString }}</span >
3+ </template >
4+ <script >
5+ export default {
6+ name: ' VueIntlNumberformat' ,
7+ props: {
8+ locale: {
9+ type: String ,
10+ default: ' en-US' ,
11+ required: false ,
12+ },
13+ formatStyle: {
14+ type: String ,
15+ default: ' decimal' ,
16+ required: false ,
17+ },
18+ currency: {
19+ type: String ,
20+ required: false ,
21+ },
22+ maxDigits: {
23+ type: Number ,
24+ required: false ,
25+ },
26+ number: {
27+ type: Number ,
28+ required: true ,
29+ },
30+ },
31+ computed: {
32+ localeString () {
33+ const t = this ;
34+ return new Intl.NumberFormat (` ${ t .locale } ` , {
35+ style: ` ${ t .formatStyle } ` ,
36+ currency: ` ${ t .currency } ` ,
37+ maximumSignificantDigits: t .maxDigits ,
38+ }).format (t .number );
39+ },
40+ },
41+ };
42+ </script >
Original file line number Diff line number Diff line change 1+ import VueIntlNumberformat from './VueIntlNumberformat.vue' ;
2+
3+ export default VueIntlNumberformat ;
You can’t perform that action at this time.
0 commit comments