vue-admin
vue-admin copied to clipboard
How to add filters?
Can you please give an example on how to use filters?
https://011.vuejs.org/api/filters.html
{{count}} {{count | pluralize item}}
What I meant to say was, how do I add filters globally and access it by using the index.js file that is included in this project inside filters folder.
In filters/index.js you do
import Foo from './foo'
export const foo = Foo
And in filters/foo.js you do:
export default (value) => {
return 'foo' + value
}
Now you can use {{ 'bar' | foo }} and result should be foobar