fix(tabbar): 修复H5环境下无tabbar时的白屏问题
当tabbar缓存未启用时,将tabBar配置设为undefined而非空对象。在H5环境下,无tabbar时设置为空对象以防止浏览器报错导致白屏
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { isH5 } from '@uni-helper/uni-env'
|
||||
import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
|
||||
import { tabBar } from './src/tabbar/config'
|
||||
|
||||
@@ -19,5 +20,6 @@ export default defineUniPages({
|
||||
},
|
||||
},
|
||||
// tabbar 的配置统一在 “./src/tabbar/config.ts” 文件中
|
||||
tabBar: tabBar as any,
|
||||
// 无tabbar模式下,h5 设置为 {} 为了防止浏览器报错导致白屏
|
||||
tabBar: tabBar || (isH5 ? {} : undefined) as any,
|
||||
})
|
||||
|
||||
@@ -153,4 +153,4 @@ const _tabbar: TabBar = {
|
||||
}
|
||||
|
||||
// 0和1 需要显示底部的tabbar的各种配置,以利用缓存
|
||||
export const tabBar = tabbarCacheEnable ? _tabbar : {}
|
||||
export const tabBar = tabbarCacheEnable ? _tabbar : undefined
|
||||
|
||||
Reference in New Issue
Block a user