Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小浣熊撸代码
uni-app
提交
6928528c
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,发现更多精彩内容 >>
提交
6928528c
编写于
9月 10, 2019
作者:
W
wangyaqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update: H5新增transparentTitle配置
上级
d6127e30
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
42 addition
and
16 deletion
+42
-16
src/core/view/bridge/subscribe/index.js
src/core/view/bridge/subscribe/index.js
+3
-3
src/platforms/h5/components/page/index.vue
src/platforms/h5/components/page/index.vue
+13
-2
src/platforms/h5/components/page/pageHead.vue
src/platforms/h5/components/page/pageHead.vue
+4
-4
src/platforms/h5/components/page/transparent.js
src/platforms/h5/components/page/transparent.js
+21
-6
src/platforms/h5/helpers/get-window-offset.js
src/platforms/h5/helpers/get-window-offset.js
+1
-1
未找到文件。
src/core/view/bridge/subscribe/index.js
浏览文件 @
6928528c
...
...
@@ -27,7 +27,7 @@ const passiveOptions = supportsPassive ? {
function
updateCssVar
(
vm
)
{
if
(
uni
.
canIUse
(
'
css.var
'
))
{
const
pageVm
=
vm
.
$parent
.
$parent
const
windowTop
=
pageVm
.
showNavigationBar
&&
pageVm
.
navigationBar
.
type
!==
'
transparent
'
?
(
NAVBAR_HEIGHT
+
const
windowTop
=
pageVm
.
showNavigationBar
&&
pageVm
.
navigationBar
.
type
!==
'
transparent
'
&&
pageVm
.
navigationBar
.
type
!==
'
alwaysTransparent
'
?
(
NAVBAR_HEIGHT
+
'
px
'
)
:
'
0px
'
const
windowBottom
=
getApp
().
$children
[
0
].
showTabBar
?
(
TABBAR_HEIGHT
+
'
px
'
)
:
'
0px
'
...
...
@@ -74,8 +74,8 @@ export default function initSubscribe (subscribe) {
const
enablePageReachBottom
=
hasLifecycleHook
(
vm
.
$options
,
'
onReachBottom
'
)
const
onReachBottomDistance
=
pageVm
.
onReachBottomDistance
const
enableTransparentTitleNView
=
isPlainObject
(
pageVm
.
titleNView
)
&&
pageVm
.
titleNView
.
type
===
'
transparent
'
const
enableTransparentTitleNView
=
(
isPlainObject
(
pageVm
.
titleNView
)
&&
pageVm
.
titleNView
.
type
===
'
transparent
'
)
||
(
isPlainObject
(
pageVm
.
navigationBar
)
&&
pageVm
.
navigationBar
.
type
===
'
transparent
'
)
if
(
scrollListener
)
{
document
.
removeEventListener
(
'
scroll
'
,
scrollListener
)
...
...
src/platforms/h5/components/page/index.vue
浏览文件 @
6928528c
...
...
@@ -136,9 +136,19 @@ export default {
titleImage
:
{
type
:
String
,
default
:
''
},
transparentTitle
:
{
type
:
String
,
default
:
'
none
'
}
},
data
()
{
data
()
{
const
titleNViewTypeList
=
{
'
none
'
:
'
default
'
,
'
auto
'
:
'
transparent
'
,
'
always
'
:
'
alwaysTransparent
'
}
const
navigationBar
=
mergeTitleNView
({
loading
:
false
,
backButton
:
!
this
.
isQuit
&&
!
this
.
$route
.
meta
.
isQuit
,
// redirectTo,reLaunch时可能动态修改 meta.isQuit
...
...
@@ -147,7 +157,8 @@ export default {
titleText
:
this
.
navigationBarTitleText
,
titleImage
:
this
.
titleImage
,
duration
:
'
0
'
,
timingFunc
:
''
timingFunc
:
''
,
type
:
titleNViewTypeList
[
this
.
transparentTitle
]
},
this
.
titleNView
)
const
showNavigationBar
=
this
.
navigationStyle
===
'
default
'
&&
this
.
titleNView
...
...
src/platforms/h5/components/page/pageHead.vue
浏览文件 @
6928528c
...
...
@@ -36,7 +36,7 @@
v-if=
"!searchInput"
class=
"uni-page-head-bd"
>
<div
:style=
"{fontSize:titleSize
,opacity:type==='transparent'?0:1
}"
:style=
"{fontSize:titleSize}"
class=
"uni-page-head__title"
>
<i
...
...
@@ -96,7 +96,7 @@
</div>
</div>
<div
v-if=
"type!=='transparent'"
v-if=
"type!=='transparent'
&&type!=='alwaysTransparent'
"
class=
"uni-placeholder"
/>
</uni-page-head>
</template>
...
...
@@ -277,7 +277,7 @@ uni-page-head .uni-page-head__title .uni-loading {
uni-page-head
.uni-page-head__title
.uni-page-head__title_image
{
width
:
auto
;
height
:
2
0
px
;
height
:
2
6
px
;
vertical-align
:
middle
;
}
</
style
>
...
...
@@ -335,7 +335,7 @@ export default {
type
:
{
default
:
'
default
'
,
validator
(
value
)
{
return
[
'
default
'
,
'
transparent
'
].
indexOf
(
value
)
!==
-
1
return
[
'
default
'
,
'
transparent
'
,
'
alwaysTransparent
'
].
indexOf
(
value
)
!==
-
1
}
},
coverage
:
{
...
...
src/platforms/h5/components/page/transparent.js
浏览文件 @
6928528c
...
...
@@ -6,7 +6,7 @@ export default {
mounted
()
{
if
(
this
.
type
===
'
transparent
'
)
{
const
transparentElemStyle
=
this
.
$el
.
querySelector
(
'
.uni-page-head-transparent
'
).
style
const
titleElem
=
this
.
$el
.
querySelector
(
'
.uni-page-head__title
'
)
//
const titleElem = this.$el.querySelector('.uni-page-head__title')
const
iconElems
=
this
.
$el
.
querySelectorAll
(
'
.uni-btn-icon
'
)
const
iconElemsStyles
=
[]
const
textColor
=
this
.
textColor
...
...
@@ -40,9 +40,10 @@ export default {
}
this
.
_A
=
alpha
// TODO 暂时仅处理背景色
if
(
titleElem
)
{
titleElem
.
style
.
opacity
=
alpha
}
// 对齐支付宝小程序,标题不透明渐变
// if (titleElem) {
// titleElem.style.opacity = alpha
// }
transparentElemStyle
.
backgroundColor
=
`rgba(
${
this
.
_R
}
,
${
this
.
_G
}
,
${
this
.
_B
}
,
${
alpha
}
)`
borderRadiusElemsStyles
.
forEach
(
function
(
borderRadiusElemStyle
,
index
)
{
let
oldColor
=
oldColors
[
index
]
...
...
@@ -52,17 +53,31 @@ export default {
borderRadiusElemStyle
.
backgroundColor
=
`rgba(
${
rgba
}
)`
})
})
}
else
if
(
this
.
type
===
'
alwaysTransparent
'
)
{
const
iconElems
=
this
.
$el
.
querySelectorAll
(
'
.uni-btn-icon
'
)
const
iconElemsStyles
=
[]
for
(
let
i
=
0
;
i
<
iconElems
.
length
;
i
++
)
{
iconElemsStyles
.
push
(
iconElems
[
i
].
style
)
}
const
borderRadiusElems
=
this
.
$el
.
querySelectorAll
(
'
.uni-page-head-btn
'
)
const
oldColors
=
[]
const
borderRadiusElemsStyles
=
[]
for
(
let
i
=
0
;
i
<
borderRadiusElems
.
length
;
i
++
)
{
let
borderRadiusElem
=
borderRadiusElems
[
i
]
oldColors
.
push
(
getComputedStyle
(
borderRadiusElem
).
backgroundColor
)
borderRadiusElemsStyles
.
push
(
borderRadiusElem
.
style
)
}
}
},
computed
:
{
color
()
{
return
this
.
type
===
'
transparent
'
?
'
#fff
'
:
this
.
textColor
return
this
.
type
===
'
transparent
'
||
this
.
type
===
'
alwaysTransparent
'
?
'
#fff
'
:
this
.
textColor
},
offset
()
{
return
parseInt
(
this
.
coverage
)
},
bgColor
()
{
if
(
this
.
type
===
'
transparent
'
)
{
if
(
this
.
type
===
'
transparent
'
||
this
.
type
===
'
alwaysTransparent
'
)
{
const
{
r
,
g
,
...
...
src/platforms/h5/helpers/get-window-offset.js
浏览文件 @
6928528c
...
...
@@ -17,7 +17,7 @@ export default function getWindowOffset () {
const
pages
=
getCurrentPages
()
if
(
pages
.
length
)
{
const
pageVm
=
pages
[
pages
.
length
-
1
].
$parent
.
$parent
top
=
pageVm
.
showNavigationBar
&&
pageVm
.
navigationBar
.
type
!==
'
transparent
'
?
NAVBAR_HEIGHT
:
0
top
=
pageVm
.
showNavigationBar
&&
(
pageVm
.
navigationBar
.
type
!==
'
transparent
'
||
pageVm
.
navigationBar
.
type
!==
'
alwaysTransparent
'
)
?
NAVBAR_HEIGHT
:
0
}
const
app
=
getApp
()
if
(
app
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录