I am trying to print an integer in Vue2 with commas as thousands separators. For example, I want to show the number 34567 as "34 567". How would I go about doing this?
<v-carousel-item
v-for="item in RANDOM_PRODUCTS"
:key="item.id"
>
<span
class="name_item_price"
>
{{ item.price[0].replace(/(\d)(?=(\d{3})+$)/g, '$1 ') }}
</span>
</v-carousel-item>
This option used to work, but now it gives an error on some pages. Error:
Error in render: "TypeError: Cannot read property 'replace' of undefined"