1
0
mirror of https://github.com/ialley-workshop-open/uni-halo.git synced 2026-07-27 04:20:43 +08:00

refactor(home&post-card): 调整点击事件绑定位置并优化空状态样式

1. 将作者卡片的点击事件从子组件移到父容器上,简化子组件依赖
2. 给空状态提示容器添加box-border类统一样式规范
3. 为文章卡片添加点击跳转详情页的逻辑
This commit is contained in:
小莫唐尼
2026-06-15 13:32:56 +08:00
parent 21eeb912fd
commit b56de87856
2 changed files with 12 additions and 6 deletions
+9 -3
View File
@@ -93,20 +93,26 @@ const textFooterClass = computed(() => {
}
return 'gap-x-2'
})
function handleToPostDetail() {
uni.navigateTo({
url: `/pages-blog/post-detail/post-detail?metadataName=${props.post.metadata.name}`,
})
}
</script>
<template>
<view v-if="post" class="uh-shadow-xs box-border w-full flex justify-center overflow-hidden rounded-2xl bg-white p-4" :class="wrapClass">
<view class="shrink-0 overflow-hidden rounded-lg" :class="coverClass">
<view class="shrink-0 overflow-hidden rounded-lg" :class="coverClass" @click="handleToPostDetail">
<image :src="completeUrl(post.spec.cover)" mode="aspectFill" class="h-full w-full" />
<view v-if="props.type === 'rightCover'" class="absolute bottom-0 left-0 top-0 z-10 h-full w-full from-white/0 via-white/10 to-white bg-gradient-to-l" />
</view>
<view class="box-border flex-1" :class="textWrapClass">
<view class="h-full flex flex-1 flex-col justify-between" :class="textContainerClass">
<view class="line-clamp-1 text-sm text-gray-900 font-bold">
<view class="line-clamp-1 text-sm text-gray-900 font-bold" @click="handleToPostDetail">
{{ post.spec.title }}
</view>
<view class="line-clamp-2 text-xs text-gray-500">
<view class="line-clamp-2 text-xs text-gray-500" @click="handleToPostDetail">
{{ post.status.excerpt }}
</view>
<view class="w-full flex items-center" :class="textFooterClass">