-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnews.vue
118 lines (114 loc) · 3.62 KB
/
news.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<template>
<div>
<v-row justify="center">
<v-col cols="12" sm="8" md="8">
<v-row justify="center">
<v-col
v-for="(item, index) in $store.getters.getNews"
:key="index"
cols="12"
md="6"
>
<v-card outlined flat>
<v-list-item>
<v-list-item-avatar color="grey">
<v-avatar>
<v-img
src="https://pbs.twimg.com/profile_images/721965025859121152/342LCLJq_400x400.jpg"
></v-img>
</v-avatar>
</v-list-item-avatar>
<v-list-item-content>
<v-list-item-title class="headline">{{
item.user
}}</v-list-item-title>
<v-list-item-subtitle>{{
$moment(new Date(item.created_at)).fromNow()
}}</v-list-item-subtitle>
</v-list-item-content>
</v-list-item>
<v-img max-height="500" :src="item.media_url"></v-img>
<v-card-text>
<h3 v-html="item.tweet"></h3>
</v-card-text>
<v-card-actions>
<v-row justify="center">
<v-col cols="12">
<v-btn
x-large
text
color="primary"
icon
@click.prevent="sharelink(item.tweetLink)"
>
<v-icon>mdi-share-variant</v-icon>
</v-btn>
</v-col>
</v-row>
</v-card-actions>
</v-card>
</v-col>
</v-row>
</v-col>
</v-row>
<v-row v-if="$fetchState.pending" justify="center">
<v-col cols="6" md="4" lg="3" xl="2" class="text-center">
<v-skeleton-loader class="mx-auto" type="card"></v-skeleton-loader>
</v-col>
<v-col cols="6" md="4" lg="3" xl="2" class="text-center">
<v-skeleton-loader class="mx-auto" type="card"></v-skeleton-loader>
</v-col>
<v-col cols="6" md="4" lg="3" xl="2" class="text-center">
<v-skeleton-loader class="mx-auto" type="card"></v-skeleton-loader>
</v-col>
<v-col cols="6" md="4" lg="3" xl="2" class="text-center">
<v-skeleton-loader class="mx-auto" type="card"></v-skeleton-loader>
</v-col>
<v-col cols="6" md="4" lg="3" xl="2" class="text-center">
<v-skeleton-loader class="mx-auto" type="card"></v-skeleton-loader>
</v-col>
<v-col cols="6" md="4" lg="3" xl="2" class="text-center">
<v-skeleton-loader class="mx-auto" type="card"></v-skeleton-loader>
</v-col>
</v-row>
</div>
</template>
<script>
export default {
async fetch() {
const news = await this.$axios.get(
'https://twitter.opensource254.co.ke/api/v2/moh_kenya?count=50'
)
this.$store.commit('addNews', news.data)
},
fetchOnServer: false,
methods: {
sharelink(link) {
if (navigator.share) {
navigator
.share({
title: 'Check out this update from MOH',
text: `Checkout this update by the ministry of health Kenya on COVID 19`,
url: link
})
.then(() => true)
.catch(() => {})
}
}
},
head() {
return {
title: 'Latest Updates From MOH',
titleTemplate: null,
meta: [
{
hid: 'description',
name: 'description',
content: 'Get the latest updates from MOH Kenya'
}
]
}
}
}
</script>
<style></style>