1

I'm using Laravel 5.7 & VueJs 2.5.* ...

I working on Invoice application, while displaying invoice i want my grand total amount to be converted in words. Like this:

Grand Total In Numbers = 10,000

Grand Total In Words = Ten thousand rupees only

Is their any Vue Filter or any way to do that ?

============ I Solved My Problem By Doing This ============

First i Installed number-to-words:

npm install number-to-words

In my app.js i did this, so i use it globally:

var converter = require('number-to-words');

Vue.filter('toWords', function(value) {
  if (!value) return '';
  return converter.toWords(value);
})

Use it in my component like this:

<template>
    <div>
        <span>{{ number | toWords }}</span>
    </div>
</template>

0 Answers0