Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Vue.js Basics!
You have completed Vue.js Basics!
Preview
Use the event object in Vue to filter a list of items by type.
NOTE: For the application to work correctly in Firefox, you must pass in the event object to the method in your Vue instance.
//In Vue instance
filterList = function(event) {...}
//In Vue template
<select v-on:change="filterList">
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
In other words, if the user chooses book,
they'll only see books.
0:00
If they choose DVD,
they'll only see DVDs and so on.
0:00
If we were fairly certain that we'd
never have more than three unique
0:04
items in this menu, then we could just
hardcode an option for each type.
0:07
In our Vue template
inside the select menu,
0:12
we could create an option for book,
an option for DVD, and so on.
0:16
But we wanna make sure
to do it dynamically, so
0:22
that any type of media we add to the list
tomorrow or five years from now,
0:25
will populate in the select menu.
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up