wy-ei / vue-filter

:v: A collection of Vue.js filter. [Depressed]
MIT License
353 stars 37 forks source link

How to get a specific parameter inside an array? #10

Closed visualcookie closed 7 years ago

visualcookie commented 7 years ago

Hi,

for my case I'm using {{movie.moviebackground | random}}. Now I want to be able to get the url parameter inside that random array/object element. How would I be able to do it with vue-filter?

wy-ei commented 7 years ago

@visualcookie vue-filter don't have a filter help you get a parameter inside an object right now. I think I should add a filter named get, it can help you get a parameter inside an object.

but, at this time, you can use I map filter before random, the output of map filter is an array which contains the parameter you want, and random filter can pick one.

{{movie.moviebackground | map getAproperty | random}}

this means you have to write a help function.