Created
June 14, 2018 03:10
-
-
Save jesraygarciano/700e7831df4677b1a03d2f9fe111c215 to your computer and use it in GitHub Desktop.
VUE ESSENTIALS CHEAT SHEET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPRESSIONS | |
<div id="app"> | |
<p>I have a {{ product }}</p> | |
<p>{{ product + 's' }}</p> | |
<p>{{ isWorking ? 'YES' : 'NO' }}</p> | |
<p>{{ product.getSalePrice() }}</p> | |
</div> | |
DIRECTIVES | |
#Element inserted/removed based on truthiness: | |
<p v-if="inStock">{{ product }}</p> | |
<p v-else-if="onSale">...</p> | |
<p v-else>...</p> | |
#Toggles the display: none CSS property: | |
<p v-show="showProductDetails">...</p> | |
#Two-way data binding: | |
<input v-model="firstName" > | |
v-model.lazy="..." #Syncs input after change event | |
v-model.number="..." #Always returns a number | |
v-model.trim="..." #Strips whitespace | |
LIST RENDERING | |
<li v-for="item in items" :key="item.id"> | |
{{ item }} | |
</li> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment