Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
良好的行为成为习惯
uni-app
提交
3f7673f0
U
uni-app
项目概览
良好的行为成为习惯
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f7673f0
编写于
10月 13, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 优化 picker 组件(pickTime、pickDate)在 iPad 上的显示位置
上级
e9ef5c1c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
55 addition
and
54 deletion
+55
-54
src/platforms/app-plus/helpers/status-bar.js
src/platforms/app-plus/helpers/status-bar.js
+4
-0
src/platforms/app-plus/service/api/device/system.js
src/platforms/app-plus/service/api/device/system.js
+4
-5
src/platforms/app-plus/service/api/util.js
src/platforms/app-plus/service/api/util.js
+1
-6
src/platforms/app-plus/service/constants.js
src/platforms/app-plus/service/constants.js
+1
-3
src/platforms/app-plus/service/framework/plugins/lifecycle.js
...platforms/app-plus/service/framework/plugins/lifecycle.js
+7
-8
src/platforms/app-plus/service/framework/webview/parser/sub-nvue-parser.js
...-plus/service/framework/webview/parser/sub-nvue-parser.js
+3
-7
src/platforms/app-plus/view/components/picker/index.vue
src/platforms/app-plus/view/components/picker/index.vue
+16
-7
src/platforms/app-plus/view/components/web-view/index.vue
src/platforms/app-plus/view/components/web-view/index.vue
+5
-2
src/platforms/app-plus/view/mixins/native.js
src/platforms/app-plus/view/mixins/native.js
+1
-16
src/platforms/app-plus/view/utils.js
src/platforms/app-plus/view/utils.js
+13
-0
未找到文件。
src/platforms/app-plus/helpers/status-bar.js
0 → 100644
浏览文件 @
3f7673f0
export
function
getStatusbarHeight
()
{
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
return
plus
.
navigator
.
isImmersedStatusbar
()
?
Math
.
round
(
plus
.
os
.
name
===
'
iOS
'
?
plus
.
navigator
.
getSafeAreaInsets
().
top
:
plus
.
navigator
.
getStatusbarHeight
())
:
0
}
src/platforms/app-plus/service/api/device/system.js
浏览文件 @
3f7673f0
...
...
@@ -2,16 +2,15 @@ import {
callApiSync
,
isTabBarPage
,
getLastWebview
,
getStatusbarHeight
,
getScreenInfo
}
from
'
../util
'
import
{
TITLEBAR_HEIGHT
}
from
'
../../constants
'
import
{
NAVBAR_HEIGHT
}
from
'
uni-helpers/constants
'
import
tabBar
from
'
../../framework/tab-bar
'
import
{
getStatusbarHeight
}
from
'
uni-platform/helpers/status-bar
'
export
function
getSystemInfoSync
()
{
return
callApiSync
(
getSystemInfo
,
Object
.
create
(
null
),
'
getSystemInfo
'
,
'
getSystemInfoSync
'
)
}
...
...
@@ -35,7 +34,7 @@ export function getSystemInfo () {
let
style
=
webview
.
getStyle
()
style
=
style
&&
style
.
titleNView
if
(
style
&&
style
.
type
&&
style
.
type
!==
'
none
'
)
{
titleNView
.
height
=
style
.
type
===
'
transparent
'
?
0
:
(
statusBarHeight
+
TITLE
BAR_HEIGHT
)
titleNView
.
height
=
style
.
type
===
'
transparent
'
?
0
:
(
statusBarHeight
+
NAV
BAR_HEIGHT
)
titleNView
.
cover
=
style
.
type
===
'
transparent
'
||
style
.
type
===
'
float
'
}
safeAreaInsets
=
webview
.
getSafeAreaInsets
()
...
...
src/platforms/app-plus/service/api/util.js
浏览文件 @
3f7673f0
...
...
@@ -154,11 +154,6 @@ const outOfChina = function (lng, lat) {
return
(
lng
<
72.004
||
lng
>
137.8347
)
||
((
lat
<
0.8293
||
lat
>
55.8271
)
||
false
)
}
export
function
getStatusbarHeight
()
{
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
return
plus
.
navigator
.
isImmersedStatusbar
()
?
Math
.
round
(
plus
.
os
.
name
===
'
iOS
'
?
plus
.
navigator
.
getSafeAreaInsets
().
top
:
plus
.
navigator
.
getStatusbarHeight
())
:
0
}
export
function
getScreenInfo
()
{
const
{
resolutionWidth
,
resolutionHeight
}
=
plus
.
screen
.
getCurrentSize
()
return
{
...
...
@@ -210,4 +205,4 @@ export function warpPlusMethod (origin, name, before) {
export
function
getFileName
(
path
)
{
const
array
=
path
.
split
(
'
/
'
)
return
array
[
array
.
length
-
1
]
}
}
src/platforms/app-plus/service/constants.js
浏览文件 @
3f7673f0
...
...
@@ -5,8 +5,6 @@ export const ANI_DURATION = 300
export
const
ANI_CLOSE
=
downgrade
?
'
slide-out-right
'
:
'
pop-out
'
export
const
TITLEBAR_HEIGHT
=
44
export
const
ON_REACH_BOTTOM_DISTANCE
=
50
export
const
VIEW_WEBVIEW_PATH
=
'
_www/__uniappview.html
'
...
...
@@ -19,4 +17,4 @@ export const V_SHOW = 'v-show'
export
const
B_CLASS
=
'
c
'
export
const
B_STYLE
=
'
s
'
export
const
S_CLASS
=
'
sc
'
export
const
S_CLASS
=
'
sc
'
src/platforms/app-plus/service/framework/plugins/lifecycle.js
浏览文件 @
3f7673f0
...
...
@@ -21,16 +21,15 @@ import {
}
from
'
../../../constants
'
import
{
ON_REACH_BOTTOM_DISTANCE
,
TITLEBAR_HEIGHT
ON_REACH_BOTTOM_DISTANCE
}
from
'
../../constants
'
import
{
NAVBAR_HEIGHT
}
from
'
uni-helpers/constants
'
import
tabBar
from
'
../tab-bar
'
import
{
getStatusbarHeight
}
from
'
../../api/util
'
import
{
getStatusbarHeight
}
from
'
uni-platform/helpers/status-bar
'
import
{
preloadSubPackages
...
...
@@ -58,7 +57,7 @@ function parsePageCreateOptions (vm, route) {
onReachBottomDistance
,
statusbarHeight
,
windowTop
:
windowOptions
.
titleNView
&&
windowOptions
.
titleNView
.
type
===
'
float
'
?
(
statusbarHeight
+
TITLE
BAR_HEIGHT
)
:
0
,
NAV
BAR_HEIGHT
)
:
0
,
windowBottom
:
(
tabBar
.
indexOf
(
route
)
>=
0
&&
tabBar
.
cover
)
?
tabBar
.
height
:
0
}
}
...
...
@@ -108,9 +107,9 @@ export function initLifecycle (Vue) {
},
mounted
()
{
if
(
this
.
mpType
===
'
page
'
)
{
callPageHook
(
this
.
$scope
,
'
onReady
'
)
callPageHook
(
this
.
$scope
,
'
onReady
'
)
preloadSubPackages
(
this
.
$scope
.
route
)
}
}
})
}
}
src/platforms/app-plus/service/framework/webview/parser/sub-nvue-parser.js
浏览文件 @
3f7673f0
import
{
TITLEBAR_HEIGHT
}
from
'
../../../constants
'
import
{
NAVBAR_HEIGHT
}
from
'
uni-helpers/constants
'
import
{
backbuttonListener
...
...
@@ -10,9 +8,7 @@ import {
isTabBarPage
}
from
'
../../../bridge
'
import
{
getStatusbarHeight
}
from
'
../../../api/util
'
import
{
getStatusbarHeight
}
from
'
uni-platform/helpers/status-bar
'
import
tabBar
from
'
../../tab-bar
'
...
...
@@ -100,7 +96,7 @@ function initSubNVue (subNVue, routeOptions, webview) {
style
.
dock
=
'
top
'
style
.
top
=
0
style
.
width
=
'
100%
'
style
.
height
=
TITLE
BAR_HEIGHT
+
getStatusbarHeight
()
style
.
height
=
NAV
BAR_HEIGHT
+
getStatusbarHeight
()
delete
style
.
left
delete
style
.
right
delete
style
.
bottom
...
...
src/platforms/app-plus/view/components/picker/index.vue
浏览文件 @
3f7673f0
...
...
@@ -11,6 +11,7 @@
import
{
emitter
}
from
'
uni-mixins
'
import
{
showPage
}
from
'
./page
'
import
*
as
webview
from
'
./webview
'
import
{
getNavigationBarHeight
}
from
'
../../utils
'
const
mode
=
{
SELECTOR
:
'
selector
'
,
...
...
@@ -198,17 +199,23 @@ export default {
}
}
},
_show
()
{
_show
(
event
)
{
if
(
this
.
disabled
)
{
return
}
const
rect
=
event
.
currentTarget
.
getBoundingClientRect
()
this
.
_showPicker
(
Object
.
assign
({},
this
.
$props
,
{
value
:
this
.
valueSync
}))
}),
{
top
:
rect
.
top
+
getNavigationBarHeight
(),
left
:
rect
.
left
,
width
:
rect
.
width
,
height
:
rect
.
height
})
},
_showPicker
(
data
)
{
_showPicker
(
data
,
popover
)
{
if
((
data
.
mode
===
mode
.
TIME
||
data
.
mode
===
mode
.
DATE
)
&&
!
data
.
fields
)
{
this
.
_showNativePicker
(
data
)
this
.
_showNativePicker
(
data
,
popover
)
}
else
{
data
.
fields
=
Object
.
values
(
fields
).
includes
(
data
.
fields
)
?
data
.
fields
:
fields
.
DAY
webview
.
exists
((
exists
)
=>
{
...
...
@@ -216,7 +223,7 @@ export default {
})
}
},
_showNativePicker
(
data
)
{
_showNativePicker
(
data
,
popover
)
{
plus
.
nativeUI
[
this
.
mode
===
mode
.
TIME
?
'
pickTime
'
:
'
pickDate
'
]((
res
)
=>
{
const
date
=
res
.
date
this
.
$trigger
(
'
change
'
,
{},
{
...
...
@@ -225,11 +232,13 @@ export default {
},
()
=>
{
this
.
$trigger
(
'
cancel
'
,
{},
{})
},
this
.
mode
===
mode
.
TIME
?
{
time
:
getDate
(
this
.
value
,
mode
.
TIME
)
time
:
getDate
(
this
.
value
,
mode
.
TIME
),
popover
}
:
{
date
:
getDate
(
this
.
value
,
mode
.
DATE
),
minDate
:
getDate
(
this
.
start
,
mode
.
DATE
),
maxDate
:
getDate
(
this
.
end
,
mode
.
DATE
)
maxDate
:
getDate
(
this
.
end
,
mode
.
DATE
),
popover
})
},
_showWeexPicker
(
data
)
{
...
...
src/platforms/app-plus/view/components/web-view/index.vue
浏览文件 @
3f7673f0
...
...
@@ -6,6 +6,9 @@ import {
WEBVIEW_INSERTED
,
WEBVIEW_REMOVED
}
from
'
../../../constants
'
import
{
NAVBAR_HEIGHT
}
from
'
uni-helpers/constants
'
let
webview
=
false
const
insertHTMLWebView
=
({
htmlId
...
...
@@ -19,9 +22,9 @@ const insertHTMLWebView = ({
const
parentTitleNView
=
parentWebview
.
getTitleNView
()
if
(
parentTitleNView
)
{
if
(
plus
.
navigator
.
isImmersedStatusbar
())
{
styles
.
top
=
44
+
plus
.
navigator
.
getStatusbarHeight
()
styles
.
top
=
NAVBAR_HEIGHT
+
plus
.
navigator
.
getStatusbarHeight
()
}
else
{
styles
.
top
=
44
styles
.
top
=
NAVBAR_HEIGHT
}
styles
.
bottom
=
0
}
...
...
src/platforms/app-plus/view/mixins/native.js
浏览文件 @
3f7673f0
const
TITLEBAR_HEIGHT
=
44
function
getStatusbarHeight
()
{
// 横屏时 iOS 获取的状态栏高度错误,进行纠正
return
plus
.
navigator
.
isImmersedStatusbar
()
?
Math
.
round
(
plus
.
os
.
name
===
'
iOS
'
?
plus
.
navigator
.
getSafeAreaInsets
().
top
:
plus
.
navigator
.
getStatusbarHeight
())
:
0
}
function
getNavigationBarHeight
()
{
const
webview
=
plus
.
webview
.
currentWebview
()
let
style
=
webview
.
getStyle
()
style
=
style
&&
style
.
titleNView
if
(
style
&&
style
.
type
===
'
default
'
)
{
return
TITLEBAR_HEIGHT
+
getStatusbarHeight
()
}
return
0
}
import
{
getNavigationBarHeight
}
from
'
../utils
'
function
getFixed
(
$el
)
{
let
fixed
...
...
src/platforms/app-plus/view/utils.js
0 → 100644
浏览文件 @
3f7673f0
import
{
getStatusbarHeight
}
from
'
uni-platform/helpers/status-bar
'
import
{
NAVBAR_HEIGHT
}
from
'
uni-helpers/constants
'
export
function
getNavigationBarHeight
()
{
const
webview
=
plus
.
webview
.
currentWebview
()
let
style
=
webview
.
getStyle
()
style
=
style
&&
style
.
titleNView
if
(
style
&&
style
.
type
===
'
default
'
)
{
return
NAVBAR_HEIGHT
+
getStatusbarHeight
()
}
return
0
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录