Spookie/assets/js/components/blog/BlogCard.vue

56 lines
1.3 KiB
Vue
Raw Normal View History

2022-05-23 16:25:55 +02:00
<template>
2022-05-25 14:41:58 +02:00
<div>
<!-- media -->
<div class="h-64 w-auto md:w-1/2">
<img
class="inset-0 h-full w-full object-cover object-center"
src="/build/images/tracer_schmolle150x150.png"
alt=""
>
</div>
<!-- content -->
<div class="w-full py-4 px-6 text-gray-800 flex flex-col justify-between">
<h3 class="font-semibold text-lg leading-tight truncate">
{{ post.title }}
</h3>
<p class="mt-2">
{{ post.body.split('.')[0] }}
</p>
<p class="text-sm text-gray-700 uppercase tracking-wide font-semibold mt-2">
{{ post.createdAt.toLocaleString('de-DE') }}
</p>
<p v-if="blogUser">
{{ blogUser }}
</p>
<p class="font-normal text-gray-700 mb-3">
dddd
</p>
<router-link
:to="{ name: 'BlogPost', params: { id: post.id } }"
class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300
font-medium rounded-lg text-sm px-3 py-2 text-center inline-flex items-center"
>
Read more
</router-link>
</div>
2022-05-23 16:25:55 +02:00
</div>
</template>
2022-05-25 14:41:58 +02:00
2022-05-23 16:25:55 +02:00
<script setup>
2022-05-25 14:41:58 +02:00
import useResource from '@/composables/useResource'
2022-05-23 16:25:55 +02:00
const props = defineProps({
post: {
type: Object,
required: true
}
})
const post = { ...props.post }
2022-05-25 14:41:58 +02:00
const { items: blogUser, fetchOne } = useResource('users')
fetchOne(post.user)
console.log("blug user", post.user)
console.log(blogUser.value)
2022-05-23 16:25:55 +02:00
</script>