A Vue favorite/like/recommend component.
Note: vue-favorite uses font-awesome by default and you will be required to pull it in your templates.
npm install vue-favorite
import Vue from 'vue'
import Favorite from 'vue-favorite'
new Vue({
el: '#app',
components: { Favorite }
})
<script src="path/to/vue/vue.min.js"></script>
<script src="path/to/vue-avatar/dist/vue-favorite.js"></script>
new Vue({
el: '#app',
components: { Favorite }
})
After that, you can use it in your templates:
<favorite
:post=1
:favorited=false
></favorite>
Name | Required | Type | Decsription |
---|---|---|---|
post | Y | Number | ID of the post |
favorited | Y | Boolean | determine whether the post has been marked as favorite |
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build