Created
May 21, 2017 09:17
-
-
Save dyaa/96c0dfba42515ad725bff2a3a0b88e76 to your computer and use it in GitHub Desktop.
Favourite Button component for Vue JS
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
<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