2024-11-17 11:45:08 +08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import {computed} from "vue";
|
2025-01-13 01:03:16 +08:00
|
|
|
import {pos} from "ipx";
|
2024-11-17 11:45:08 +08:00
|
|
|
|
|
|
|
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"
|
2025-01-13 01:03:16 +08:00
|
|
|
class="container relative overflow-hidden rounded-2xl bg-white transition-all duration-300 ease-in-out h-[31rem] hover:-translate-y-2 hover:cursor-pointer hover:shadow"
|
2024-12-02 20:09:54 +08:00
|
|
|
:to="{name: 'article-cid', params: {cid: post.cid}}">
|
2024-11-17 11:45:08 +08:00
|
|
|
<!-- 图片 -->
|
2025-01-13 01:03:16 +08:00
|
|
|
<div class="relative">
|
|
|
|
<!-- 渐变 -->
|
|
|
|
<div class="absolute top-0 right-0 bottom-0 left-0 bg-gradient-to-t from-white"></div>
|
2024-12-18 08:43:00 +08:00
|
|
|
<img v-if="thumbUrl" :src="thumbUrl" alt=""
|
2025-01-13 01:03:16 +08:00
|
|
|
class="aspect-video w-full h-auto object-cover object-center">
|
2024-12-18 08:43:00 +08:00
|
|
|
<card-article-default-image :id="randomId"/>
|
2024-11-17 11:45:08 +08:00
|
|
|
</div>
|
|
|
|
<!-- 文字部分 -->
|
2025-01-13 01:03:16 +08:00
|
|
|
<div class="px-5">
|
|
|
|
<!-- 标题 -->
|
|
|
|
<h4 class="text-2xl font-bold">{{ post.title }}</h4>
|
|
|
|
<p class="mt-4 text-lg px-1 text-gray-700">{{ post.digest }}</p>
|
2024-11-17 11:45:08 +08:00
|
|
|
</div>
|
2024-12-02 20:00:21 +08:00
|
|
|
</nuxt-link>
|
2024-11-17 11:45:08 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|