♻️ 部分分区动态获取,重构部分调用

This commit is contained in:
目棃
2025-01-17 16:06:36 +08:00
parent da78d27239
commit c9f74537b0
18 changed files with 216 additions and 185 deletions

View File

@@ -3,7 +3,7 @@
<div class="tops-box">
<div class="tops-top">查找{{ search }}</div>
<div class="tops-act">
<span>分区{{ getGameName(Number(game)) }}</span>
<span>分区{{ gameName }}</span>
<v-btn :loading="load" size="small" class="tops-btn" @click="searchPosts()" rounded>
加载更多({{ results.length }})
</v-btn>
@@ -21,9 +21,9 @@ import TOverlay from "@comp/app/t-overlay.vue";
import TPostCard from "@comp/app/t-postcard.vue";
import showSnackbar from "@comp/func/snackbar.js";
import Mys from "@Mys/index.js";
import { onMounted, ref, shallowRef, watch } from "vue";
import { computed, onMounted, ref, shallowRef, watch } from "vue";
import { getGameName } from "@/utils/toolFunc.js";
import TGBbs from "@/utils/TGBbs.js";
type ToPostSearchProps = { gid: string; keyword?: string };
@@ -35,6 +35,9 @@ const game = ref<string>("2");
const isLast = ref<boolean>(false);
const load = ref<boolean>(false);
const results = shallowRef<Array<TGApp.Plugins.Mys.Post.FullData>>([]);
const gameName = computed<string>(
() => TGBbs.channels.find((v) => v.gid.toString() === game.value)?.title || "未知分区",
);
onMounted(async () => {
game.value = props.gid;