fix: 在PC端,需要 uni.hideTabBar()

This commit is contained in:
陆柯 2023-05-14 10:46:16 +08:00
parent c30c4cc66d
commit 076a42f86f

View File

@ -75,6 +75,9 @@ export default {
// document.title = ??? // document.title = ???
// #endif // #endif
if (uni.getSystemInfoSync().deviceType === 'pc') {
uni.hideTabBar()
} else {
// 必须要在有 tab 的页面里 setTabBarItem 才有效果 // 必须要在有 tab 的页面里 setTabBarItem 才有效果
//const midIndex = parseInt(pagesJson?.tabBar?.list?.length/2) // 如果存在midButton,实际上tabBar.list.length必须为偶数。不过为了心安再parseInt一下。 //const midIndex = parseInt(pagesJson?.tabBar?.list?.length/2) // 如果存在midButton,实际上tabBar.list.length必须为偶数。不过为了心安再parseInt一下。
pagesJson?.tabBar?.list?.forEach((tab, tabIndex) => { pagesJson?.tabBar?.list?.forEach((tab, tabIndex) => {
@ -90,26 +93,7 @@ export default {
}) })
} }
}) })
// uni.showTabBar({}) }
// 不再使用 topWindow 方案
// // #ifdef H5
// // 响应式方案:仅仅根据当前设备类型,如果是 PC 大屏幕,则始终显示 topWindow 并且隐藏顶部 navibar 和底部 tabBar。
// if (pagesJson?.topWindow || !envar?.showBarsOnPC) {
// // 如果页头不是通过 pagesJson.topWindow 而是作为组件来引入个别页面,那么定义配置参数 showBarsOnPC 来控制。
// if (uni.getSystemInfoSync().deviceType === 'pc') {
// if (window.innerWidth > (pagesJson?.topWindow?.matchMedia?.minWidth || 0)) {
// uni.hideTabBar()
// // 不知为何,同一个二级页面,如果第二次进入,就仍然会显示 navibar, 必须通过 setTimeout 执行才能彻底隐藏。
// setTimeout(() => {
// document.getElementsByTagName('uni-page-head')?.[0]?.remove()
// }, 0)
// }
// } else {
// document.getElementsByTagName('uni-top-window')?.[0]?.remove() // 强制隐藏 topWindow否则在手机浏览器里topWindow 会遮挡掉 navibar。
// }
// }
// // #endif
//#ifdef H5 //#ifdef H5
//// 微信浏览器里,本身就显示了标题栏,和自有的导航栏形成功能重叠和混淆。 //// 微信浏览器里,本身就显示了标题栏,和自有的导航栏形成功能重叠和混淆。