Get started with vue2-filters CDN

MIT licensed

Vue.js plugin: Vue2-filters - data formatting filters.

Tags:
  • vuejs
  • vue
  • filters
  • vue2-filters

Stable version

Copied!

How to start using vue2-filters CDN


<template>
  <div>
    <p>Original price: {{ originalPrice }}</p>
    <p>Discounted price: {{ discountedPrice }}</p>
  </div>
</template>

<script>
import Vue from 'vue'
import { currency, formatMoney } from 'vue2-filters/es/filters'

Vue.use(Vue.extend(currency))
Vue.use(Vue.extend(formatMoney))

export default {
  data() {
    return {
      originalPrice: 19.99,
      discount: 0.1,
    }
  },
  computed: {
    discountedPrice() {
      return this.formatMoney(this.originalPrice * (1 - this.discount))
    },
  },
}
</script>
Copied!
Copied!

All versions