评论滚动添加防抖

master
于肖磊 2026-02-28 11:07:13 +08:00
parent 21469948ed
commit 127f4ba2b5
1 changed files with 15 additions and 4 deletions

View File

@ -298,6 +298,7 @@
base_config_data: {},
video_switch_debounce_timer: null, //
video_cleanup_timer: null, //
comment_scroll_debounce_timer: null, //
//
active_dropdown_id: null, // ID
params: {},
@ -307,7 +308,6 @@
current_main_index: 0, //
current_sub_index: 0, //
report_comment_id: '', // id
comment_scroll_top: 0,
comment_value: '',
is_add_comment: false,
//
@ -412,6 +412,9 @@
if (this.video_cleanup_timer) {
clearTimeout(this.video_cleanup_timer);
}
if (this.comment_scroll_debounce_timer) {
clearTimeout(this.comment_scroll_debounce_timer);
}
//
this.cleanup_all_videos();
@ -948,13 +951,21 @@
this.setData({
active_dropdown_id: null,
show_comment_modal: false,
comment_scroll_top: 0 + Math.random(), //
move_distance: 0,
})
},
// ,
// ,
handle_comment_scroll(e) {
console.log(e);
this.comment_scroll_top = e.detail.scrollTop;
//
if (this.comment_scroll_debounce_timer) {
clearTimeout(this.comment_scroll_debounce_timer);
}
//
this.comment_scroll_debounce_timer = setTimeout(() => {
this.comment_scroll_top = e.detail.scrollTop;
}, 200); // 100ms
},
//
handle_comment_to_lower_scroll() {