Created
November 23, 2017 04:29
-
-
Save akbarsahata/cb132f2460bc44c716bd0ef48a828c71 to your computer and use it in GitHub Desktop.
miracle-fox vue component
This file contains hidden or 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
Vue.component('news-item', { | |
template: ` | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
{{article.title}} | |
</div> | |
<div class="panel-body"> | |
<img :src="article.urlToImage" class="img-responsive img-thumbnail"> | |
<p>{{article.description}}</p> | |
<input type="text" v-model="article.title" /> | |
</div> | |
<div class="panel-footer"> | |
<button class="btn btn-info" @click="readMore">Read more</button> | |
</div> | |
</div> | |
`, | |
props: ['article'], | |
data: function () { | |
return { | |
name: 'Fullstack Developer at Travelola', | |
description: 'Savant Node.JS developer with experience with Vue.js' | |
} | |
}, | |
methods: { | |
readMore: function () { | |
this.$emit('unread-minus-one', { | |
title: this.article.title | |
}) | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment