提交 4024f429 编写于 作者: Q qiang

fix: v3-app 支持 windowBottom

上级 b257c342
......@@ -125,15 +125,14 @@ const PLATFORMS = {
filterTag: 'wxs',
subPackages: false,
cssVars: {
'--window-top': '0px',
'--window-bottom': '0px'
'--window-top': '0px'
},
copyWebpackOptions ({
assetsDir,
vueOptions
}) {
if (
vueOptions &&
}) {
if (
vueOptions &&
vueOptions.pluginOptions &&
vueOptions.pluginOptions['uni-app-plus'] &&
vueOptions.pluginOptions['uni-app-plus']['view']
......@@ -155,9 +154,9 @@ const PLATFORMS = {
require.resolve('@dcloudio/uni-app-plus/dist/view.css'),
require.resolve('@dcloudio/uni-app-plus/dist/view.umd.min.js')
])
template = [
...getCopyOptions([path.resolve(__dirname, '../template/common')]),
...getCopyOptions([path.resolve(__dirname, '../template/v3')])
template = [
...getCopyOptions([path.resolve(__dirname, '../template/common')]),
...getCopyOptions([path.resolve(__dirname, '../template/v3')])
]
}
return [
......@@ -558,4 +557,4 @@ module.exports = {
getPlatformSass () {
return SASS
}
}
}
......@@ -48,8 +48,9 @@ export function getSystemInfo () {
} else {
safeAreaInsets = ios ? plus.navigator.getSafeAreaInsets() : getSafeAreaInsets()
}
var windowBottom = isTabBarPage() && tabBar.visible && tabBar.cover ? tabBar.height : 0
var windowHeight = Math.min(screenHeight - (titleNView ? (statusBarHeight + TITLEBAR_HEIGHT)
: 0) - (isTabBarPage() && tabBar.visible ? tabBar.height : 0), screenHeight)
: 0) - windowBottom, screenHeight)
var windowWidth = screenWidth
var safeArea = {
left: safeAreaInsets.left,
......@@ -77,7 +78,7 @@ export function getSystemInfo () {
platform,
SDKVersion: '',
windowTop: 0,
windowBottom: 0,
windowBottom,
safeArea
}
}
......@@ -20,6 +20,8 @@ import {
}
from '../../constants'
import tabBar from '../tab-bar'
function parsePageCreateOptions (vm, route) {
const pagePath = '/' + route
const routeOptions = __uniRoutes.find(route => route.path === pagePath)
......@@ -39,7 +41,7 @@ function parsePageCreateOptions (vm, route) {
onPageReachBottom,
onReachBottomDistance,
windowTop: 0, // TODO
windowBottom: 0 // TODO
windowBottom: (tabBar.indexOf(route) >= 0 && tabBar.cover) ? tabBar.height : 0
}
}
......@@ -76,4 +78,4 @@ export function initLifecycle (Vue) {
}
}
})
}
}
......@@ -7,8 +7,10 @@ import {
requireNativePlugin
} from '../bridge'
const TABBAR_HEIGHT = 50
import safeAreaInsets from './safe-area-insets'
const TABBAR_HEIGHT = 50
const isIOS = plus.os.name === 'iOS'
let config
/**
......@@ -73,7 +75,7 @@ function setTabBarStyle (style) {
}
/**
* 隐藏 tabBar
* @param {boolean} animation 是否需要动画效果 暂未支持
* @param {boolean} animation 是否需要动画效果
*/
function hideTabBar (animation) {
visible = false
......@@ -83,7 +85,7 @@ function hideTabBar (animation) {
}
/**
* 显示 tabBar
* @param {boolean} animation 是否需要动画效果 暂未支持
* @param {boolean} animation 是否需要动画效果
*/
function showTabBar (animation) {
visible = true
......@@ -110,7 +112,7 @@ export default {
publish('onTabBarMidButtonTap', {})
})
},
switchTab (page) {
indexOf (page) {
const itemLength = config.list.length
if (itemLength) {
for (let i = 0; i < itemLength; i++) {
......@@ -118,13 +120,20 @@ export default {
config.list[i].pagePath === page ||
config.list[i].pagePath === `${page}.html`
) {
tabBar && tabBar.switchSelect({
index: i
})
return true
return i
}
}
}
return -1
},
switchTab (page) {
const index = this.indexOf(page)
if (index >= 0) {
tabBar && tabBar.switchSelect({
index
})
return true
}
return false
},
setTabBarBadge,
......@@ -148,7 +157,13 @@ export default {
return visible
},
get height () {
return config && config.height ? parseFloat(config.height) : TABBAR_HEIGHT
return (config && config.height ? parseFloat(config.height) : TABBAR_HEIGHT) + safeAreaInsets.bottom
},
// tabBar是否遮挡内容区域
get cover () {
const array = ['extralight', 'light', 'dark']
// 设置背景颜色会失效
return isIOS && array.indexOf(config.blurEffect) >= 0 && !config.backgroundColor
},
setStyle ({ mask }) {
tabBar.setMask({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册