fix: 移除无用的滚动事件处理和相关方法,优化组件加载逻辑
This commit is contained in:
		
							parent
							
								
									1a05539731
								
							
						
					
					
						commit
						cceb6eed43
					
				|  | @ -84,8 +84,6 @@ | ||||||
|         scroll-with-animation |         scroll-with-animation | ||||||
|         :scroll-top="scrollTop" |         :scroll-top="scrollTop" | ||||||
|         :show-scrollbar="true" |         :show-scrollbar="true" | ||||||
|         @scrolltoupper="loadMoreMessages" |  | ||||||
|         @scroll="onScroll" |  | ||||||
|       > |       > | ||||||
|         <!-- 头部卡片 --> |         <!-- 头部卡片 --> | ||||||
|         <!-- 后端让先注释 --> |         <!-- 后端让先注释 --> | ||||||
|  | @ -380,16 +378,7 @@ export default { | ||||||
|     }, |     }, | ||||||
|   }, |   }, | ||||||
|   onLoad() {}, |   onLoad() {}, | ||||||
|   mounted() { |   mounted() {}, | ||||||
|     this.$nextTick(() => { |  | ||||||
|       this.scrollToBottom(); |  | ||||||
|     }); |  | ||||||
|   }, |  | ||||||
|   updated() { |  | ||||||
|     this.$nextTick(() => { |  | ||||||
|       this.scrollToBottom(); |  | ||||||
|     }); |  | ||||||
|   }, |  | ||||||
|   methods: { |   methods: { | ||||||
|     handleLeftClick() { |     handleLeftClick() { | ||||||
|       this.$u.api.GetConversationPage().then((res) => { |       this.$u.api.GetConversationPage().then((res) => { | ||||||
|  | @ -415,16 +404,6 @@ export default { | ||||||
|       }); |       }); | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|     selectChatItem(index) { |  | ||||||
|       this.activeIndex = index; |  | ||||||
|     }, |  | ||||||
|     loadMoreMessages() { |  | ||||||
|       // 加载更多历史消息的实现 |  | ||||||
|       console.log("加载更多历史消息"); |  | ||||||
|     }, |  | ||||||
|     onScroll(event) { |  | ||||||
|       // 滚动事件处理 |  | ||||||
|     }, |  | ||||||
|     scrollToBottom() { |     scrollToBottom() { | ||||||
|       // 使用nextTick确保DOM已更新 |       // 使用nextTick确保DOM已更新 | ||||||
|       this.$nextTick(() => { |       this.$nextTick(() => { | ||||||
|  | @ -434,6 +413,7 @@ export default { | ||||||
|           .select(".chat-content") |           .select(".chat-content") | ||||||
|           .boundingClientRect((data) => { |           .boundingClientRect((data) => { | ||||||
|             if (data) { |             if (data) { | ||||||
|  |               console.log("data", data); | ||||||
|               // 计算滚动到底部的位置 |               // 计算滚动到底部的位置 | ||||||
|               const scrollHeight = data.height; |               const scrollHeight = data.height; | ||||||
|               // 设置滚动位置,加100px确保滚动到底部 |               // 设置滚动位置,加100px确保滚动到底部 | ||||||
|  | @ -558,8 +538,6 @@ export default { | ||||||
|             // 否则按时间升序排列 |             // 否则按时间升序排列 | ||||||
|             return timeA - timeB; |             return timeA - timeB; | ||||||
|           }); |           }); | ||||||
| 
 |  | ||||||
|           this.scrollToBottom(); |  | ||||||
|         }); |         }); | ||||||
|     }, |     }, | ||||||
| 
 | 
 | ||||||
|  | @ -588,7 +566,7 @@ page { | ||||||
|   background-repeat: no-repeat; |   background-repeat: no-repeat; | ||||||
|   background-size: 100% 100%; |   background-size: 100% 100%; | ||||||
|   background-position: 0 88rpx; |   background-position: 0 88rpx; | ||||||
|   // overflow: hidden; /* 改为 hidden 防止页面整体滚动 */ |   background-attachment: fixed; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .home-container { | .home-container { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue