I used the custom filter solution proposed by @Jess but in my project we are using Vue together with TypeScript. This is how it looks like with TypeScript and class decorators:
import Component from 'vue-class-component';
import { Filter } from 'vue-class-decorator';
@Component
export default class Home extends Vue {
@Filter('toCurrency')
private toCurrency(value: number): string {
if (isNaN(value)) {
return '';
}
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
minimumFractionDigits: 0
});
return formatter.format(value);
}
}
In this example the filter can only be used inside the component. I haven't tried to implement it as a global filter, yet.