diff --git a/pages/common/im_chat_info.vue b/pages/common/im_chat_info.vue index bc709d3..ae88c48 100644 --- a/pages/common/im_chat_info.vue +++ b/pages/common/im_chat_info.vue @@ -6,6 +6,7 @@ @@ -90,7 +91,8 @@ export default { content: '',//文本内容(JSON 格式扩展字段),文本类型=纯文字,图片类型=绝对路径 }, - lastItemId: null, + isFirstLoad: true, // 标记是否为首次加载 + scrollTop:'', } }, onLoad(options) { @@ -137,16 +139,10 @@ export default { //获取聊天记录列表 await this.getList(); - // 更新最后一个 item 的 ID - this.lastItemId = 'item_' + (this.tableList.length - 1); - - // 滚动到底部 - this.$nextTick(() => { - this.$refs.scrollView.scrollTo({ top: this.scrollViewHeight }); - }); - - // 或者直接使用 scroll-into-view - this.scrollIntoView = this.lastItemId; + // 首次加载后滚动到底部 + if (this.filteredData.page == 2) { + this.scrollToBottom() + } }, //获取好友关系详情 @@ -303,6 +299,13 @@ export default { } }, + //页面滚动到底部 + scrollToBottom() { + alert(1) + this.$nextTick(() => { + this.scrollTop = 999999 // 足够大的值确保滚动到底部 + }) + }, } }