Home > Blockchain >  How can I convert cents to units in vuejs?
How can I convert cents to units in vuejs?

Time:12-15

For example I have 1000 cents which would be 10 dollars, how can I do it? this is my code, I have data taken from an API

    <b-button variant="outline-primary mb-2">
{{contract.reward_cents}} {{contract.reward_currency}}
</b-button>

CodePudding user response:

i'm not sure if i understand you correctly. you just want contract.reward_cents to be converted to dollars?

you can do it like this:

{{ Number(contract.reward_cents)/100 }}
  • Related