Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add filters? #234

Open
rojermaharjan opened this issue Oct 15, 2017 · 3 comments
Open

How to add filters? #234

rojermaharjan opened this issue Oct 15, 2017 · 3 comments

Comments

@rojermaharjan
Copy link

Can you please give an example on how to use filters?

@acampagnaro
Copy link

https://011.vuejs.org/api/filters.html

{{count}} {{count | pluralize item}}

@rojermaharjan
Copy link
Author

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.

@bytebrain
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants