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