修复 H5 嵌入小程序导航栏冲突
Some checks failed
CI / verify (push) Has been cancelled

- 识别微信小程序 web-view 宿主环境
- 宿主导航存在时隐藏 H5 自绘返回与页面标题
- 收回详情、搜索、讲解列表页面顶部预留空间

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
lyf
2026-07-10 10:57:06 +08:00
parent 8758fe66c6
commit 2a21108157
6 changed files with 93 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class="poi-search-page">
<view class="search-header">
<view class="poi-search-page" :class="{ 'host-navigation': shouldUseHostNavigation }">
<view v-if="!shouldUseHostNavigation" class="search-header">
<view class="search-header-copy">
<text class="page-title">点位搜索</text>
<text class="page-subtitle">Search Museum Locations</text>
@@ -21,11 +21,13 @@
</template>
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from 'vue'
import { computed, onMounted, onUnmounted, ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import PoiSearchPanel from '@/components/search/PoiSearchPanel.vue'
import { isEmbeddedInWechatMiniProgram } from '@/utils/hostEnvironment'
const initialKeyword = ref('')
const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
onLoad((options: any) => {
const keyword = typeof options.keyword === 'string'
@@ -119,6 +121,14 @@ onUnmounted(() => {
}
/* #endif */
.poi-search-page.host-navigation {
padding-top: 0;
}
.poi-search-page.host-navigation::before {
display: none;
}
.search-header {
position: relative;
z-index: 1;