修改页面显示处理
parent
6f0764eaee
commit
8e7ff38443
|
|
@ -542,14 +542,6 @@
|
|||
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]);
|
||||
|
||||
|
|
@ -628,12 +620,6 @@
|
|||
// 替换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);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<view class="wh-auto ht-auto pr video-container bottom-line-exclude-bottom">
|
||||
<template v-if="tabs.length > 0">
|
||||
<scroll-view scroll-y :show-scrollbar="false" class="ht" lower-threshold="60" scroll-with-animation="true">
|
||||
<scroll-view scroll-y :show-scrollbar="false" class="ht" lower-threshold="60" scroll-with-animation="true" @scroll="on_scroll_event">
|
||||
<view class="wh-auto ht-auto pr">
|
||||
<!-- 搜索框 -->
|
||||
<view class="header-top">
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
</view>
|
||||
<template v-if="tabs.length > 0">
|
||||
<!-- 导航栏 -->
|
||||
<view class="nav-tabs">
|
||||
<view class="nav-tabs" :class="{ 'nav-tabs-sticky': is_nav_sticky }">
|
||||
<scroll-view scroll-x :show-scrollbar="false" class="tabs-scroll" style="white-space: nowrap;">
|
||||
<view class="tabs-scroll-content">
|
||||
<view v-for="(item, index) in tabs" :key="index" class="tab-item flex-row align-c gap-5" :class="{ active: current_tabs_index === index }" :data-index="index" :data-id="item.id" @tap="switch_tab">
|
||||
|
|
@ -109,6 +109,8 @@ export default {
|
|||
menu_button_info: '',
|
||||
header_padding_left: '',
|
||||
slider_list: [],
|
||||
is_nav_sticky: false, // 控制nav-tabs是否处于粘性状态
|
||||
nav_sticky_threshold: 50 // 粘性阈值,与CSS中的top值对应
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
|
|
@ -237,6 +239,14 @@ export default {
|
|||
handle_back() {
|
||||
app.globalData.page_back_prev_event();
|
||||
},
|
||||
// 滚动事件处理
|
||||
on_scroll_event(e) {
|
||||
const scrollTop = e.detail.scrollTop;
|
||||
// 当滚动距离大于等于阈值时,设置nav-tabs为粘性状态(背景变白)
|
||||
this.setData({
|
||||
is_nav_sticky: scrollTop >= this.nav_sticky_threshold
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -254,8 +264,14 @@ export default {
|
|||
top: 110rpx;
|
||||
width: 100%;
|
||||
padding: 0 16rpx 20rpx 16rpx;
|
||||
background: #fff;
|
||||
z-index: 9;
|
||||
background: transparent; // 默认透明背景
|
||||
transition: background-color 0.3s ease; // 添加背景色过渡动画
|
||||
|
||||
&.nav-tabs-sticky {
|
||||
background: #fff; // 粘性状态时背景变白
|
||||
}
|
||||
|
||||
.tabs-scroll-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
Loading…
Reference in New Issue