3👍
You could use a combination of a computed property and Intl.NumberFormat (or some currency npm package).
<template>
<div>{{costCurrency}}</div>
</template>
<script>
const formatter = new Intl.NumberFormat('en-US', {style: 'currency', currency: 'USD'})
export default {
props: {
cost: Number
},
computed: {
costCurrency() {
return formatter.format(cost)
}
}
}
</script>
- [Vuejs]-Problem with external async function in vue mounted
- [Vuejs]-Is there a method to update a data object from vue when the database updates?
- [Vuejs]-How to prevent javascript files from showing in view source?
- [Vuejs]-Async/await axios in external file
Source:stackexchange.com