No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Currency formatting

    Framework
    3
    4
    3247
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      amoss last edited by

      Hi

      I want to format numbers as a currency. There are 2 places for that

      1. Template
      <div class="money">${{ this.money.toLocaleString() }}</div>
      
      1. 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

      1 Reply Last reply Reply Quote 0
      • T
        tof06 last edited by

        I would use vue-i18n number localization : https://kazupon.github.io/vue-i18n/guide/number.html

        1 Reply Last reply Reply Quote 0
        • metalsadman
          metalsadman last edited by

          also native Intl.NumberFormat https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

          A 1 Reply Last reply Reply Quote 0
          • A
            amoss @metalsadman last edited by

            @metalsadman Nice! it even have the symbol itself… Thanks a lot!

            1 Reply Last reply Reply Quote 0
            • First post
              Last post