Skip to content

Instantly share code, notes, and snippets.

@akbarsahata
Created November 23, 2017 04:29
Show Gist options
  • Save akbarsahata/cb132f2460bc44c716bd0ef48a828c71 to your computer and use it in GitHub Desktop.
Save akbarsahata/cb132f2460bc44c716bd0ef48a828c71 to your computer and use it in GitHub Desktop.
miracle-fox vue component
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