Browse Source

fix: ios部分设备出现白屏的bug

master
xsx 5 months ago
parent
commit
aa18f59f4c
  1. 32
      im-uniapp/pages/chat/chat-box.vue

32
im-uniapp/pages/chat/chat-box.vue

@ -642,13 +642,21 @@ export default {
}); });
}, },
onClickToBottom() { onClickToBottom() {
this.scrollToBottom(); /**
// * 有些ios设备在点击回到底部后页面会卡住原因不详
// 100s * 解决方式: 延迟300ms再滚动
*/
setTimeout(() => { setTimeout(() => {
this.isInBottom = true; this.scrollToBottom();
this.newMessageSize = 0; /**
}, 100) * 有些设备滚到底部时会莫名触发滚动到顶部的事件
* 解决方式: 延迟100ms保证能准确设置底部标志
*/
setTimeout(() => {
this.isInBottom = true;
this.newMessageSize = 0;
}, 100)
}, 300)
}, },
onScroll(e) { onScroll(e) {
// //
@ -656,16 +664,14 @@ export default {
}, },
onScrollToTop() { onScrollToTop() {
if (this.showMinIdx > 0) { if (this.showMinIdx > 0) {
// #ifndef H5 //
// appscroll-into-view
this.scrollToMsgIdx(this.showMinIdx);
// #endif
// #ifdef H5
// h5scroll-top
if (uni.getSystemInfoSync().platform == 'ios') { if (uni.getSystemInfoSync().platform == 'ios') {
// iosscroll-top
this.holdingScrollBar(this.scrollViewHeight); this.holdingScrollBar(this.scrollViewHeight);
} else {
// scroll-into-view
this.scrollToMsgIdx(this.showMinIdx);
} }
// #endif
// 20 // 20
this.showMinIdx = this.showMinIdx > 20 ? this.showMinIdx - 20 : 0; this.showMinIdx = this.showMinIdx > 20 ? this.showMinIdx - 20 : 0;
} }

Loading…
Cancel
Save