fix(mini-program): 彻底修复剧本详情页布局超出屏幕问题

根本原因:
- height: 100vh 在小程序中包含状态栏区域,导致内容超出可视范围
- CSS env(safe-area-inset-top) 和 max() 函数在 uni-app 中支持有限

修复方案:
- 改用 height: 100% 替代 100vh
- 添加独立的状态栏占位 view,高度从 App.vue 存储的全局值读取
- 移除对 CSS env() 和 max() 函数的依赖
- header 顶部 padding 改用固定值 12px
This commit is contained in:
2026-04-07 22:26:17 +08:00
parent b8dc438cbe
commit 8338204bcc
@@ -1,5 +1,8 @@
<template>
<view class="detail-view">
<!-- 状态栏占位 -->
<view :style="{ height: statusBarHeight + 'px' }" class="status-bar-placeholder"></view>
<view class="detail-header">
<view class="header-left" @click="goBack">
<text class="back-icon"></text>
@@ -47,10 +50,14 @@ import Markdown from '../../components/Markdown.vue'
const store = useAppStore()
const script = ref(null)
const fullContent = ref('')
const statusBarHeight = ref(0)
const scripts = computed(() => store.scripts || [])
onMounted(() => {
// 获取状态栏高度(从 App.vue 存储的全局值)
statusBarHeight.value = uni.getStorageSync('statusBarHeight') || 20
// 获取剧本 ID
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
@@ -79,17 +86,23 @@ const goBack = () => {
.detail-view {
display: flex;
flex-direction: column;
height: 100vh;
overflow: hidden;
height: 100%;
background: linear-gradient(180deg, #0F071A 0%, #1A0B2E 50%, #0F071A 100%);
}
/* 状态栏占位 */
.status-bar-placeholder {
width: 100%;
flex-shrink: 0;
background: transparent;
}
/* ==================== 顶部导航栏 ==================== */
.detail-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: max(12px, env(safe-area-inset-top)) 32rpx 24rpx;
padding: 12px 32rpx 24rpx;
background: rgba(168, 85, 247, 0.1);
border-bottom: 1px solid rgba(168, 85, 247, 0.2);
flex-shrink: 0;