Skip to content

Any opportunity to send data variable in filter? #259

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

Closed
dmfilipenko opened this issue May 9, 2014 · 4 comments · Fixed by turkdevops/vue#1 · 4 remaining pull requests
Closed

Any opportunity to send data variable in filter? #259

dmfilipenko opened this issue May 9, 2014 · 4 comments · Fixed by turkdevops/vue#1 · 4 remaining pull requests

Comments

@dmfilipenko
Copy link

I have such example http://jsfiddle.net/s5LrB/, how i can pass into filter variable from data (multiplyNumber), without declare it in such way this.multiplyNumber in filter.

@dmfilipenko dmfilipenko changed the title Any opportunity to send data variable in filter Any opportunity to send data variable in filter? May 9, 2014
@opudalo
Copy link

opudalo commented May 9, 2014

I don't vote it's the best way, but i did small helper inside filter itself to get value by path.
http://jsfiddle.net/s5LrB/3/

@bpierre
Copy link

bpierre commented May 9, 2014

You can use this.$get(): http://jsfiddle.net/s5LrB/6/

@yyx990803
Copy link
Member

Filter arguments are always passed as plain strings. vm.$get will retrieve a value from a keypath for you, and if it doesn't exist on current VM, it will recursively fallback to try the parent.

@dmfilipenko
Copy link
Author

Greate, thanks

Hanks10100 pushed a commit to Hanks10100/vue that referenced this issue May 6, 2018
optimize: 事件处理函数不存在时输出提示
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment