Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

vue format number as dollars

// This filter can be used in any page.

Vue.filter('toCurrency', function (value) {
    if (typeof value !== "number") {
        return value;
    }
    var formatter = new Intl.NumberFormat('en-US', {
        style: 'currency',
        currency: 'USD'
    });
    return formatter.format(value);
});

// Then use this filter like this:
<td class="text-right">
{{ invoice.fees | toCurrency }}
</td>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #vue #format #number #dollars
ADD COMMENT
Topic
Name
9+4 =