diff --git a/src/api/chat.ts b/src/api/chat.ts index 6d6f7ae..f16d8b8 100644 --- a/src/api/chat.ts +++ b/src/api/chat.ts @@ -69,7 +69,7 @@ export const apiMsgCount = (wxids: string[]) => { } export const apiMsgCountSolo = (wxid: string) => { return apiMsgCount([wxid]).then((res: any) => { - return res[wxid]; + return res[wxid] || 0; }).catch((err: any) => { console.log(err); return 0; diff --git a/src/components/chat/ChatRecordsMain.vue b/src/components/chat/ChatRecordsMain.vue index 663e88b..87c7657 100644 --- a/src/components/chat/ChatRecordsMain.vue +++ b/src/components/chat/ChatRecordsMain.vue @@ -130,7 +130,8 @@ const init = async () => { msg_count.value = await apiMsgCountSolo(props.wxid); // 切换最后一页 - start.value = Math.floor(msg_count.value / limit.value) * limit.value; + console.log('msg_count.value', msg_count.value, limit.value) + start.value = Math.floor(msg_count.value / limit.value) * limit.value || 0 await fetchData("bottom"); } catch (error) { console.error('Error fetching data:', error);