Currency formatting
-
Hi
I want to format numbers as a currency. There are 2 places for that
- Template
<div class="money">${{ this.money.toLocaleString() }}</div>
- Script
"$" + response.data.result[item].toLocaleString()
Obviously, this works great for $ but now I want to show a different symbol (I have a list of currency->symbol) instead of $. On the internet there are a lot of suggestions and recommendations, including filters, i18n etc…
Is there something built in to quasar? Is there a recommended way to achieve this out of all the options out there?
Thanks
-
I would use vue-i18n number localization : https://kazupon.github.io/vue-i18n/guide/number.html
-
also native Intl.NumberFormat https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
-
@metalsadman Nice! it even have the symbol itself… Thanks a lot!