round number with whichever decimal accuracy
npm install vue-round-filter``javascript`
let round = require('vue-round-filter');
// or es6
import round from 'vue-round-filter';`javascript`
new Vue({
filters: {
round,
},
});`usage
javascript`
let pi = 3.14159265359;`html
{{ pi | round }}
3
{{ pi | round 2 }}
3.14
`true
If you're need to keep decimal accuracy, pass as second argument
`javascript`
let int = 3;`html
{{ int | round 3 }}
3
{{ int | round 3 true }}
3.000
``