Skip to content

Instantly share code, notes, and snippets.

@dyaa
Created May 21, 2017 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dyaa/96c0dfba42515ad725bff2a3a0b88e76 to your computer and use it in GitHub Desktop.
Save dyaa/96c0dfba42515ad725bff2a3a0b88e76 to your computer and use it in GitHub Desktop.
Favourite Button component for Vue JS
<template>
<button class="btn btn-sm btn-primary" v-on:click="togglefav" ><i v-bind:class="[is_fav ? 'fa-heart' : 'fa-heart-o', 'fa']" aria-hidden="true"></i></button>
</template>
<script>
export default {
props:['is_fav'],
methods:{
togglefav:function(){
this.$emit('togglefav',!this.is_fav);
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment