🎨 调整帖子卡片点击处理

This commit is contained in:
目棃
2025-03-08 16:41:54 +08:00
parent d8267cbf7b
commit 6b5959ff76
3 changed files with 21 additions and 18 deletions

View File

@@ -14,7 +14,6 @@
class="tpoc-item"
v-for="(item, index) in postList"
:key="index"
@click="toPost(item.post.post_id, index)"
:model-value="item"
:class="{ selected: index === props.collection.cur - 1 }"
/>
@@ -25,17 +24,13 @@
<script lang="ts" setup>
import TOverlay from "@comp/app/t-overlay.vue";
import TPostcard from "@comp/app/t-postcard.vue";
import showSnackbar from "@comp/func/snackbar.js";
import { nextTick, onMounted, shallowRef, useTemplateRef, watch } from "vue";
import { useRouter } from "vue-router";
// import bbsReq from "@/web/request/bbsReq.js";
import postReq from "@/web/request/postReq.js";
type TpoCollectionProps = { collection: TGApp.BBS.Post.Collection; gid: number };
const router = useRouter();
const props = defineProps<TpoCollectionProps>();
const visible = defineModel<boolean>();
const postList = shallowRef<Array<TGApp.BBS.Post.FullData>>([]);
@@ -57,14 +52,6 @@ watch(
onMounted(async () => {
postList.value = await postReq.collection(props.collection.collection_id);
});
async function toPost(postId: string, index: number): Promise<void> {
if (index === props.collection.cur - 1) {
showSnackbar.warn("已经在当前帖子");
return;
}
await router.push({ name: "帖子详情", params: { post_id: postId } });
}
</script>
<style lang="css" scoped>
.tpoc-box {