-
Notifications
You must be signed in to change notification settings - Fork 1
/
PostCard.vue
64 lines (62 loc) · 1.16 KB
/
PostCard.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
<template>
<div class="post">
<v-img-pc class="img" :src="post.image" alt="Cat" />
<div>
<nuxt-link :to="post.dir">
<h3 class="heading">
{{ post.title }}
</h3>
</nuxt-link>
<p>
<i>{{ formatDate(post.date) }}</i>
</p>
<p>{{ post.description }}</p>
<v-tags :tags="post.tags" />
</div>
</div>
</template>
<script>
export default {
props: {
post: {
type: Object,
required: true
}
},
methods: {
formatDate (date) {
const options = { year: 'numeric', month: 'long', day: 'numeric' }
return new Date(date).toLocaleDateString('en', options)
}
}
}
</script>
<style scoped>
.post {
border-radius: 8px;
box-shadow: 1px 1px 10px 0 rgba(32, 33, 36, 0.1);
padding: 15px 20px;
margin: 10px 0;
display: flex;
}
.img {
width: 200px;
min-width: 100px;
margin-right: 10px;
padding: 0;
display: inline-block;
position: relative;
}
.img /deep/ img {
/*position: absolute;*/
width: 100%;
height: 100%;
max-height: 150px;
/*object-fit: cover;*/
display: inline-block;
object-fit: contain;
}
.heading {
margin-bottom: 5px;
}
</style>