提交 70b4f9da 编写于 作者: Q qiang

fix: 修复tabBar页面使用原生安全区占位的情况下获取的窗口高度错误的问题

上级 fcd27352
export default {
get bottom () {
if (plus.os.name === 'iOS') {
const safeArea = plus.navigator.getSafeAreaInsets()
return safeArea ? safeArea.bottom : 0
}
return 0
}
}
...@@ -7,8 +7,6 @@ import { ...@@ -7,8 +7,6 @@ import {
requireNativePlugin requireNativePlugin
} from '../bridge' } from '../bridge'
import safeAreaInsets from './safe-area-insets'
const TABBAR_HEIGHT = 50 const TABBAR_HEIGHT = 50
const isIOS = plus.os.name === 'iOS' const isIOS = plus.os.name === 'iOS'
let config let config
...@@ -92,8 +90,8 @@ function showTabBar (animation) { ...@@ -92,8 +90,8 @@ function showTabBar (animation) {
tabBar && tabBar.showTabBar({ tabBar && tabBar.showTabBar({
animation animation
}) })
} }
let maskClickCallback = [] let maskClickCallback = []
export default { export default {
...@@ -106,11 +104,11 @@ export default { ...@@ -106,11 +104,11 @@ export default {
tabBar = requireNativePlugin('uni-tabview') tabBar = requireNativePlugin('uni-tabview')
} catch (error) { } catch (error) {
console.log(`uni.requireNativePlugin("uni-tabview") error ${error}`) console.log(`uni.requireNativePlugin("uni-tabview") error ${error}`)
} }
tabBar.onMaskClick(() => { tabBar.onMaskClick(() => {
maskClickCallback.forEach((callback) => { maskClickCallback.forEach((callback) => {
callback() callback()
}) })
}) })
tabBar && tabBar.onClick(({ index }) => { tabBar && tabBar.onClick(({ index }) => {
clickCallback(config.list[index], index) clickCallback(config.list[index], index)
...@@ -164,7 +162,7 @@ export default { ...@@ -164,7 +162,7 @@ export default {
return visible return visible
}, },
get height () { get height () {
return (config && config.height ? parseFloat(config.height) : TABBAR_HEIGHT) + safeAreaInsets.bottom return (config && config.height ? parseFloat(config.height) : TABBAR_HEIGHT) + plus.navigator.getSafeAreaInsets().deviceBottom
}, },
// tabBar是否遮挡内容区域 // tabBar是否遮挡内容区域
get cover () { get cover () {
...@@ -177,11 +175,11 @@ export default { ...@@ -177,11 +175,11 @@ export default {
color: mask color: mask
}) })
}, },
addEventListener (name, callback) { addEventListener (name, callback) {
maskClickCallback.push(callback) maskClickCallback.push(callback)
}, },
removeEventListener (name, callback) { removeEventListener (name, callback) {
let callbackIndex = maskClickCallback.indexOf(callback) let callbackIndex = maskClickCallback.indexOf(callback)
maskClickCallback.splice(callbackIndex, 1) maskClickCallback.splice(callbackIndex, 1)
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册