diff --git a/src/components/app/t-postcard.vue b/src/components/app/t-postcard.vue
index 86db6a88..cd64f45d 100644
--- a/src/components/app/t-postcard.vue
+++ b/src/components/app/t-postcard.vue
@@ -19,23 +19,18 @@
@@ -126,10 +121,12 @@ import { storeToRefs } from "pinia";
import { computed, onMounted, ref, shallowRef, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
+/** 帖子卡片参数 */
type TPostCardProps = {
- modelValue: TGApp.BBS.Post.FullData;
+ /** 帖子数据 */
+ post: TGApp.BBS.Post.FullData;
+ /** 是否开启选择模式 */
selectMode?: boolean;
- userClick?: boolean;
};
type TPostCardEmits = {
(e: "onSelected", v: string): void;
@@ -178,17 +175,17 @@ const cardBg = computed
(() => {
const forumBg = computed(() =>
str2Color(`${card.value?.forum?.id}${card.value?.forum?.icon}${card.value?.forum?.name}`, -60),
);
-const idBg = computed(() => str2Color(`${props.modelValue.post.post_id}`, 0));
+const idBg = computed(() => str2Color(`${props.post.post.post_id}`, 0));
-onMounted(async () => (card.value = getPostCard(props.modelValue)));
+onMounted(async () => (card.value = getPostCard(props.post)));
watch(
- () => props.modelValue,
- async () => (card.value = getPostCard(props.modelValue)),
+ () => props.post,
+ async () => (card.value = getPostCard(props.post)),
);
function trySelect(): void {
- if (props.selectMode) emits("onSelected", props.modelValue.post.post_id);
+ if (props.selectMode) emits("onSelected", props.post.post.post_id);
isSelected.value = !isSelected.value;
}
@@ -293,20 +290,20 @@ async function shareCard(): Promise {
async function toTopic(topic: TGApp.BBS.Post.Topic): Promise {
if (props.selectMode) return;
- const gid = props.modelValue.post.game_id;
+ const gid = props.post.post.game_id;
await emit("active_deep_link", `router?path=/posts/topic/${gid}/${topic.id}`);
}
async function toForum(forum: RenderForum): Promise {
if (props.selectMode) return;
- const gid = props.modelValue.post.game_id;
+ const gid = props.post.post.game_id;
await emit("active_deep_link", `router?path=/posts/forum/${gid}/${forum.id}`);
}
function onUserClick(): void {
if (props.selectMode) return;
if (!card.value || card.value.user === null) return;
- emits("onUserClick", card.value.user, props.modelValue.post.game_id);
+ emits("onUserClick", card.value.user, props.post.post.game_id);
}