Skip to content

Instantly share code, notes, and snippets.

@karimal

karimal/feed.vue

Last active Jun 25, 2018
Embed
What would you like to do?
Feed component for Vuejs
<template id="feed">
<div>
<div v-for="tweet in feed" :key="tweet.title" class="tweet">
<div class="avatarContainer">
<img :src="tweet.avatar" class="avatar" width="70" height="70">
</div>
<div class="tweetBody">
<div class="tweetHead">
<span class="author">
{{ tweet.author }}
</span>
{{ tweet.date }}
</div>
<div class="tweetContent">
{{ tweet.body }}
</div>
</div>
</div>
</div>
</template>
<script>
module.exports = {
data: function() {
return {
data: store.data
}
},
computed: {
feed() {
return this.data.feed.filter(tweet => {
return tweet.body.indexOf(this.data.search) > -1;
})
}
}
}
</script>
<style>
.avatarContainer {
margin-right: 20px;
}
.avatar {
margin-top: 3px;
border-radius: 50%;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.