Update: Merge remote changes and preserve local features
This commit is contained in:
parent
d32801cb5b
commit
638f13df1f
|
|
@ -71,6 +71,7 @@ Page({
|
|||
// 滚动控制
|
||||
scrollIntoView: '',
|
||||
scrollTop: 0, // 当前滚动位置
|
||||
scrollAnimation: false, // 控制滚动动画
|
||||
|
||||
// 加载状态
|
||||
loading: true,
|
||||
|
|
@ -636,7 +637,8 @@ Page({
|
|||
isFirstLoad: false,
|
||||
hasMore: true // 假设还有更多,允许下拉
|
||||
}, () => {
|
||||
this.scrollToBottom()
|
||||
// 首次加载(缓存)使用无动画滚动,避免视觉跳动
|
||||
this.scrollToBottom(false)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -685,7 +687,8 @@ Page({
|
|||
page: 1,
|
||||
isFirstLoad: false
|
||||
}, () => {
|
||||
this.scrollToBottom()
|
||||
// API更新时也使用无动画滚动,确保位置稳定
|
||||
this.scrollToBottom(false)
|
||||
// 更新缓存
|
||||
this.saveMessagesToCache(finalMessages)
|
||||
})
|
||||
|
|
@ -1260,13 +1263,15 @@ Page({
|
|||
/**
|
||||
* 滚动到底部(仅在发送/接收新消息时调用)
|
||||
* 使用 scroll-into-view 属性,自动滚动到最后一条消息
|
||||
* @param {boolean} animated - 是否使用动画滚动,默认true
|
||||
*/
|
||||
scrollToBottom() {
|
||||
scrollToBottom(animated = true) {
|
||||
const messages = this.data.messages
|
||||
if (messages && messages.length > 0) {
|
||||
// 使用 setTimeout 确保 DOM 已更新
|
||||
setTimeout(() => {
|
||||
this.setData({
|
||||
scrollAnimation: animated,
|
||||
scrollIntoView: `msg-${messages.length - 1}`
|
||||
})
|
||||
}, 100)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
scroll-y
|
||||
class="chat-scroll"
|
||||
scroll-into-view="{{scrollIntoView}}"
|
||||
scroll-with-animation="{{true}}"
|
||||
scroll-with-animation="{{scrollAnimation}}"
|
||||
enhanced="{{true}}"
|
||||
show-scrollbar="{{false}}"
|
||||
bindscroll="onScroll"
|
||||
|
|
|
|||
|
|
@ -63,22 +63,7 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 如何加入说明 -->
|
||||
<view class="how-to-join">
|
||||
<view class="join-icon-wrapper">
|
||||
<view class="join-icon">
|
||||
<view class="dot dot-1"></view>
|
||||
<view class="dot dot-2"></view>
|
||||
<view class="dot dot-3"></view>
|
||||
<view class="dot dot-4"></view>
|
||||
<view class="line"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="join-content">
|
||||
<view class="join-title">如何加入</view>
|
||||
<view class="join-desc">点击上方感兴趣的分类,保存二维码图片或长按扫码识别,一键申请即可。</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 底部占位 -->
|
||||
<view style="height: 60rpx;"></view>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user