提交 057fb9c2 编写于 作者: Q qiang

feat: app 端 tabbar 支持自定义高度

上级 65abb12b
...@@ -64,6 +64,8 @@ module.exports = function (pagesJson, userManifestJson) { ...@@ -64,6 +64,8 @@ module.exports = function (pagesJson, userManifestJson) {
navigationBarTextStyle = 'white', navigationBarTextStyle = 'white',
navigationBarBackgroundColor = '#000000' navigationBarBackgroundColor = '#000000'
} = appJson['window'] || {} } = appJson['window'] || {}
const TABBAR_HEIGHT = 56
let manifestJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './manifest.json'), 'utf8')) let manifestJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './manifest.json'), 'utf8'))
...@@ -364,7 +366,7 @@ module.exports = function (pagesJson, userManifestJson) { ...@@ -364,7 +366,7 @@ module.exports = function (pagesJson, userManifestJson) {
// 纯 nvue 带 tab // 纯 nvue 带 tab
if (pagesJson.tabBar && pagesJson.tabBar.list && pagesJson.tabBar.list.length) { if (pagesJson.tabBar && pagesJson.tabBar.list && pagesJson.tabBar.list.length) {
const tabBar = manifestJson.plus.tabBar = Object.assign({}, pagesJson.tabBar) const tabBar = manifestJson.plus.tabBar = Object.assign({}, pagesJson.tabBar)
tabBar.height = '56px' tabBar.height = `${parseFloat(tabBar.height) || TABBAR_HEIGHT}px`
// 首页是 tabBar 页面 // 首页是 tabBar 页面
const item = tabBar.list.find(page => page.pagePath === appJson.pages[0]) const item = tabBar.list.find(page => page.pagePath === appJson.pages[0])
if (item) { if (item) {
...@@ -374,7 +376,7 @@ module.exports = function (pagesJson, userManifestJson) { ...@@ -374,7 +376,7 @@ module.exports = function (pagesJson, userManifestJson) {
} }
} else if (pagesJson.tabBar && pagesJson.tabBar.list && pagesJson.tabBar.list.length) { } else if (pagesJson.tabBar && pagesJson.tabBar.list && pagesJson.tabBar.list.length) {
const tabBar = manifestJson.plus.tabBar = Object.assign({}, pagesJson.tabBar) const tabBar = manifestJson.plus.tabBar = Object.assign({}, pagesJson.tabBar)
tabBar.height = '56px' tabBar.height = `${parseFloat(tabBar.height) || TABBAR_HEIGHT}px`
if (isNVueEntryPage) { if (isNVueEntryPage) {
manifestJson.plus.launchwebview.id = '2' manifestJson.plus.launchwebview.id = '2'
} else { } else {
......
...@@ -5,7 +5,6 @@ import { ...@@ -5,7 +5,6 @@ import {
} from '../util' } from '../util'
import { import {
TABBAR_HEIGHT,
TITLEBAR_HEIGHT TITLEBAR_HEIGHT
} from '../../constants' } from '../../constants'
...@@ -50,7 +49,7 @@ export function getSystemInfo () { ...@@ -50,7 +49,7 @@ export function getSystemInfo () {
safeAreaInsets = ios ? plus.navigator.getSafeAreaInsets() : getSafeAreaInsets() safeAreaInsets = ios ? plus.navigator.getSafeAreaInsets() : getSafeAreaInsets()
} }
var windowHeight = Math.min(screenHeight - (titleNView ? (statusBarHeight + TITLEBAR_HEIGHT) var windowHeight = Math.min(screenHeight - (titleNView ? (statusBarHeight + TITLEBAR_HEIGHT)
: 0) - (isTabBarPage() && tabBar.visible ? TABBAR_HEIGHT : 0), screenHeight) : 0) - (isTabBarPage() && tabBar.visible ? tabBar.height : 0), screenHeight)
var windowWidth = screenWidth var windowWidth = screenWidth
var safeArea = { var safeArea = {
left: safeAreaInsets.left, left: safeAreaInsets.left,
......
export const ANI_SHOW = 'pop-in' export const ANI_SHOW = 'pop-in'
export const ANI_DURATION = 300 export const ANI_DURATION = 300
export const TABBAR_HEIGHT = 56 export const TITLEBAR_HEIGHT = 44
export const TITLEBAR_HEIGHT = 44
...@@ -6,6 +6,8 @@ import { ...@@ -6,6 +6,8 @@ import {
requireNativePlugin requireNativePlugin
} from '../bridge' } from '../bridge'
const TABBAR_HEIGHT = 56
let config let config
/** /**
...@@ -137,5 +139,8 @@ export default { ...@@ -137,5 +139,8 @@ export default {
}, },
get visible () { get visible () {
return visible return visible
},
get height () {
return config && config.height ? parseFloat(config.height) : TABBAR_HEIGHT
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册