Skip to content

Instantly share code, notes, and snippets.

@christopheragnus
Created October 29, 2018 13:36
Show Gist options
  • Save christopheragnus/9833b0f31e8171e7bd4e8ed6eb97735d to your computer and use it in GitHub Desktop.
Save christopheragnus/9833b0f31e8171e7bd4e8ed6eb97735d to your computer and use it in GitHub Desktop.
Vuejs 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" >
//Sync input after change event
v-model.lazy="..."
// Always returns a number
v-model.number="..."
//Strips whitespace
v-model.trim="..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment