2024-11-17 11:45:08 +08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import {computed} from "vue";
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
post: IPost
|
|
|
|
}>()
|
|
|
|
|
2024-12-18 08:43:00 +08:00
|
|
|
const pid = useAsyncData('pid', async () => (Math.floor(Math.random() * (7 - 1 + 1)) + 1).toString())
|
|
|
|
|
|
|
|
const thumbUrl = computed(() => props.post.fields.thumb.value)
|
|
|
|
|
|
|
|
const randomId = computed(() => pid.data.value!)
|
2024-11-17 11:45:08 +08:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2024-12-02 20:00:21 +08:00
|
|
|
<nuxt-link :title="post.title"
|
2024-11-17 11:45:08 +08:00
|
|
|
class="container relative h-56 overflow-hidden rounded-2xl text-white hover:cursor-pointer hover:text-amber-200 hover:shadow-lg"
|
2024-12-02 20:09:54 +08:00
|
|
|
:to="{name: 'article-cid', params: {cid: post.cid}}">
|
2024-11-17 11:45:08 +08:00
|
|
|
<!-- 图片 -->
|
|
|
|
<div class="container h-full">
|
2024-12-18 08:43:00 +08:00
|
|
|
<img v-if="thumbUrl" :src="thumbUrl" alt=""
|
2024-11-17 11:45:08 +08:00
|
|
|
class="h-full w-full object-cover object-center transition-all duration-300 hover:scale-110">
|
2024-12-18 08:43:00 +08:00
|
|
|
<card-article-default-image :id="randomId"/>
|
2024-11-17 11:45:08 +08:00
|
|
|
</div>
|
|
|
|
<!-- 文字部分 -->
|
|
|
|
<div class="container relative">
|
|
|
|
<div class="absolute bottom-0 h-12 w-full truncate bg-black bg-opacity-60 p-2 leading-8 backdrop-blur-3xl">
|
|
|
|
<span class="px-1 text-xl font-bold transition-all">{{ post.title }}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- 分类 -->
|
|
|
|
<div class="absolute top-0 left-0 m-2 rounded-lg bg-black bg-opacity-60 px-2 text-white backdrop-blur-3xl">
|
|
|
|
<span>{{ post.category }}</span>
|
|
|
|
</div>
|
|
|
|
<!-- 日期 -->
|
|
|
|
<div class="absolute right-0 bottom-12 m-2 rounded-lg bg-black bg-opacity-60 px-2 text-white backdrop-blur-3xl">
|
|
|
|
<font-awesome-icon :icon="['far', 'clock']" class="mr-1 text-sm"/>
|
|
|
|
<span>{{ post.date.year }}-{{ post.date.month }}-{{ post.date.day }}</span>
|
|
|
|
</div>
|
2024-12-02 20:00:21 +08:00
|
|
|
</nuxt-link>
|
2024-11-17 11:45:08 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|