Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
Learn how to show or hide part of your template based on certain conditions.
Review
v-show hides or shows an HTML element based on the value it is passed. When passed a "true" or a truthy value, the element will show. When passed a "false" or falsey value, the element will be hidden.
You can directly set v-show to true or false:
<div id="app">
<h1 v-show="false">Click Me!</h1> <!-- This element will be hidden -->
</div>
Or pass it a property with a value of true or false:
<div id="app">
<h1 v-show="propertyOnDataObject">Click Me!</h1> <!-- This element will be hidden until the value of "propertyOnDataObject" becomes true -->
</div>
new Vue({
el: '#app',
data: {
propertyOnDataObject: false
}
});
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Alexandru Muntean
8,333 Points1 Answer
-
PLUS
Ramesh Kunwar
Courses Plus Student 4,066 Points1 Answer
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
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