修改页面标题处理

master
于肖磊 2026-02-26 17:11:50 +08:00
parent 40de907c29
commit 748e78c024
1 changed files with 41 additions and 33 deletions

View File

@ -542,6 +542,14 @@
this.update_display_data();
setTimeout(() => {
//#ifdef H5
//
const current_video = this.video_data_list.find(item => item.id == id);
if (current_video && current_video.title) {
document.title = current_video.title;
}
//#endif
// //
this.update_share_info(this.display_video_list[this.current_index]);
@ -600,39 +608,39 @@
// swiper
process_swiper_change(current) {
//
this.pause_all_videos_except(current);
const id = this.display_video_list[current].id;
//
this.setData({
current_index: current,
paused: false,
is_manual_pause: false,
current_video_progress: 0,
current_video_duration: 1,
is_seeking: false,
current_video_id: id, // ID
});
//#ifdef H5
// 使URLSearchParams
const url = new URL(location.href);
url.searchParams.set('id', id);
// URL
const pathname = location.href.split('?')[0];
history.replaceState(null, '', pathname + url.search);
//
const currentVideo = this.video_data_list.find(item => item.id == id);
if (currentVideo && currentVideo.videoContent) {
document.title = currentVideo.videoContent;
}
//#endif
const index = this.video_data_list.findIndex(item => item.id == id);
//
if (index < 2 && this.direction == 'prev') {
this.get_last_or_next_data_list(this.video_data_list[0].id, 1, 0);
} else if (index < this.video_data_list.length - 3 && this.direction == 'next') {
this.pause_all_videos_except(current);
const id = this.display_video_list[current].id;
//
this.setData({
current_index: current,
paused: false,
is_manual_pause: false,
current_video_progress: 0,
current_video_duration: 1,
is_seeking: false,
current_video_id: id, // ID
});
//#ifdef H5
// 使URLSearchParams
const url = new URL(location.href);
url.searchParams.set('id', id);
// URL
const pathname = location.href.split('?')[0];
history.replaceState(null, '', pathname + url.search);
//
const current_video = this.video_data_list.find(item => item.id == id);
if (current_video && current_video.title) {
document.title = current_video.title;
}
//#endif
const index = this.video_data_list.findIndex(item => item.id == id);
//
if (index < 2 && this.direction == 'prev') {
this.get_last_or_next_data_list(this.video_data_list[0].id, 1, 0);
} else if (index < this.video_data_list.length - 3 && this.direction == 'next') {
this.get_last_or_next_data_list(this.video_data_list[this.video_data_list.length - 1].id, 0, 1);
}
//