|
2 | 2 | <div class="flex flex-row gap-6 justify-between size-screen bg-white" style="font-family: 'Noto Sans SC', sans-serif;"> |
3 | 3 | <div class="flex-1 flex-col basis-1/2 m-4"> |
4 | 4 | <p>{{ useSiteConfig().name }} {{ routePath }}</p> |
| 5 | + <div v-if="error instanceof ApiResponseError"> |
| 6 | + <p class="text-7xl">{{ error.errorCode }}</p> |
| 7 | + <template v-if="_.isString(error.errorInfo)"> |
| 8 | + <p v-for="(info, _k) in error.errorInfo.split('\n')" :key="_k">{{ info }}</p> |
| 9 | + </template> |
| 10 | + <template v-else-if="_.isObject(error.errorInfo)"> |
| 11 | + <p class="whitespace-pre">{{ JSON.stringify(error.errorInfo, null, 4) }}</p> |
| 12 | + </template> |
| 13 | + </div> |
5 | 14 | <h2 v-if="firstPostPageForumName !== undefined">{{ firstPostPageForumName }}吧</h2> |
6 | 15 | <p v-if="firstImageBase64 !== null">右侧为查询结果中第一张图片(不一定来自第一条帖子)</p> |
7 | 16 | <p v-if="currentQueryType !== 'postID'" class="m-0">下方为查询结果中第一条主题帖/回复帖/楼中楼</p> |
|
24 | 33 |
|
25 | 34 | <script setup lang="ts"> |
26 | 35 | import type { UnwrapRef } from 'vue'; |
| 36 | +import _ from 'lodash'; |
27 | 37 |
|
28 | 38 | const { currentQueryType, queryParam, initialPageCursor } = defineProps<{ |
29 | 39 | routePath: string, |
30 | 40 | currentQueryType: UnwrapRef<QueryFormDeps['currentQueryType']>, |
31 | 41 | queryParam: ApiPosts['queryParam'] | undefined, |
32 | 42 | initialPageCursor?: string |
33 | 43 | }>(); |
34 | | -const { data } = useApiPosts(ref(queryParam), { initialPageParam: initialPageCursor }); |
| 44 | +const { data, error } = useApiPosts(ref(queryParam), { initialPageParam: initialPageCursor }); |
35 | 45 |
|
36 | 46 | const { firstPostPage, firstPostPageForumName, firstThread } = useFirstPost(data); |
37 | 47 | const firstThreadTitle = computed(() => firstThread.value?.title); |
|
0 commit comments