vuejs / Discussion

Vue.js discussion
167 stars 17 forks source link

Custom filter from existing filter #215

Open AntoineAugusti opened 9 years ago

AntoineAugusti commented 9 years ago

Hey,

I'd like to create a custom filter and also use an already existing filter in the function definition.

For example, I'd like to create a custom filter called pounds that calls the existing filter currency with £.

How can I achieve this?

yyx990803 commented 9 years ago

Vue.filter('currency')(value, '£')

AntoineAugusti commented 9 years ago

Thanks. My final goal is having an integer instead of a float. £12 instead of £12.00. I was thinking about using a sub string + the currency filter.