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

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

上级 65abb12b
......@@ -64,6 +64,8 @@ module.exports = function (pagesJson, userManifestJson) {
navigationBarTextStyle = 'white',
navigationBarBackgroundColor = '#000000'
} = appJson['window'] || {}
const TABBAR_HEIGHT = 56
let manifestJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, './manifest.json'), 'utf8'))
......@@ -364,7 +366,7 @@ module.exports = function (pagesJson, userManifestJson) {
// 纯 nvue 带 tab
if (pagesJson.tabBar && pagesJson.tabBar.list && pagesJson.tabBar.list.length) {
const tabBar = manifestJson.plus.tabBar = Object.assign({}, pagesJson.tabBar)
tabBar.height = '56px'
tabBar.height = `${parseFloat(tabBar.height) || TABBAR_HEIGHT}px`
// 首页是 tabBar 页面
const item = tabBar.list.find(page => page.pagePath === appJson.pages[0])
if (item) {
......@@ -374,7 +376,7 @@ module.exports = function (pagesJson, userManifestJson) {
}
} else if (pagesJson.tabBar && pagesJson.tabBar.list && pagesJson.tabBar.list.length) {
const tabBar = manifestJson.plus.tabBar = Object.assign({}, pagesJson.tabBar)
tabBar.height = '56px'
tabBar.height = `${parseFloat(tabBar.height) || TABBAR_HEIGHT}px`
if (isNVueEntryPage) {
manifestJson.plus.launchwebview.id = '2'
} else {
......
......@@ -5,7 +5,6 @@ import {
} from '../util'
import {
TABBAR_HEIGHT,
TITLEBAR_HEIGHT
} from '../../constants'
......@@ -50,7 +49,7 @@ export function getSystemInfo () {
safeAreaInsets = ios ? plus.navigator.getSafeAreaInsets() : getSafeAreaInsets()
}
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 safeArea = {
left: safeAreaInsets.left,
......
export const ANI_SHOW = 'pop-in'
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 {
requireNativePlugin
} from '../bridge'
const TABBAR_HEIGHT = 56
let config
/**
......@@ -137,5 +139,8 @@ export default {
},
get 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.
先完成此消息的编辑!
想要评论请 注册