@bum/vue-filters
v0.1.6
Published
A collection of Vue.js filters
Downloads
4
Readme
@bum/vue-filters
In Vue 1 Filters, there's a list of bultin filters those removed from Vue2.
If we want to reuse those filters, just add @bum/vue-filters
into dependencies.
yarn add @bum/vue-filters
- Use all built-in filters from
@bum/vue-filters
import Vue from 'vue'
import VueFilters from '@bum/vue-filters'
Vue.use(VueFilters)
- Select bilt-in filters, seperated by 'space'
import Vue from 'vue'
import VueFilters from '@bum/vue-filters'
Vue.use(VueFilters, { filters: "lowercase uppercase" })
- Make your custom filter with any transform function
import Vue from 'vue'
import { filter, uppercase } from '@bum/vue-filters'
Vue.use(filter(uppercase))
- Combine custom filter with
lodash
functions
yarn add lodash
import Vue from 'vue'
import { filter } from '@bum/vue-filters'
import { toLower, toUpper } from 'lodash/string'
Vue.use(filter(toLower, toUpper))
<div>{{ 'youR Name'|toUpper }}</div>
Built-in Filters
String
- capitalize
- currency
- lowercase
- placeholder
- pluralize
- trim
- truncate
- uppercase
Array
- filterBy
- findBy
- limitBy
- orderBy
lodash
functions
(use custom filter)