Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
ff59356a
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff59356a
编写于
2月 27, 2019
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 解决透明渐变导航栏按钮背景色和文字颜色配置不生效的问题
上级
79b2408c
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
26 addition
and
14 deletion
+26
-14
src/platforms/h5/components/page/pageHead.vue
src/platforms/h5/components/page/pageHead.vue
+14
-9
src/platforms/h5/components/page/transparent.js
src/platforms/h5/components/page/transparent.js
+12
-5
未找到文件。
src/platforms/h5/components/page/pageHead.vue
浏览文件 @
ff59356a
...
...
@@ -8,6 +8,7 @@
<div
class=
"uni-page-head-hd"
>
<div
v-show=
"backButton"
class=
"uni-page-head-btn"
@
click=
"_back"
>
<i
:style=
"
{color:color,fontSize:'27px'}"
...
...
@@ -17,7 +18,8 @@
<div
v-if=
"btn.float === 'left'"
:key=
"index"
:style=
"
{marginRight:index>0?'5px':'0px'}">
:style=
"
{marginRight:index>0?'5px':'0px',backgroundColor: btn.background}"
class="uni-page-head-btn">
<i
:style=
"_formatBtnStyle(btn)"
class=
"uni-btn-icon"
...
...
@@ -59,16 +61,18 @@
:placeholder-style=
"`color:${searchInput.placeholderColor}`"
class=
"uni-page-head-search-input"
confirm-type=
"search"
@
focus=
"_
_
focus"
@
blur=
"_
_
blur"
@
input=
"_
_
input"
@
focus=
"_focus"
@
blur=
"_blur"
@
input=
"_input"
/>
</div>
<div
class=
"uni-page-head-ft"
>
<
template
v-for=
"(btn,index) in btns"
>
<div
v-if=
"btn.float !== 'left'"
:key=
"index"
>
:key=
"index"
:style=
"
{backgroundColor: btn.background}"
class="uni-page-head-btn">
<i
:style=
"_formatBtnStyle(btn)"
class=
"uni-btn-icon"
...
...
@@ -143,12 +147,13 @@ uni-page-head .uni-page-head-bd {
user-select
:
auto
;
}
.uni-
btn-ico
n
{
.uni-
page-head-bt
n
{
max-width
:
48px
;
word-break
:
keep-all
;
margin
:
0
2px
;
overflow
:
hidden
;
word-break
:
keep-all
;
background-color
:
rgba
(
153
,
153
,
153
,
1
);
}
.uni-page-head-search
{
...
...
@@ -383,13 +388,13 @@ export default {
}
return
style
},
_
_
focus
()
{
_focus
()
{
this
.
focus
=
true
},
_
_
blur
()
{
_blur
()
{
this
.
focus
=
false
},
_
_
input
()
{
_input
()
{
UniServiceJSBridge
.
emit
(
'
onNavigationBarSearchInputChanged
'
,
{
text
:
this
.
text
})
...
...
src/platforms/h5/components/page/transparent.js
浏览文件 @
ff59356a
...
...
@@ -9,13 +9,17 @@ export default {
const
titleElem
=
this
.
$el
.
querySelector
(
'
.uni-page-head__title
'
)
const
iconElems
=
this
.
$el
.
querySelectorAll
(
'
.uni-btn-icon
'
)
const
iconElemsStyles
=
[]
const
textColor
=
this
.
textColor
for
(
let
i
=
0
;
i
<
iconElems
.
length
;
i
++
)
{
iconElemsStyles
.
push
(
iconElems
[
i
].
style
)
}
const
borderRadiusElems
=
this
.
$el
.
querySelectorAll
(
'
.uni-page-head-hd>div,.uni-page-head-ft>div
'
)
const
borderRadiusElems
=
this
.
$el
.
querySelectorAll
(
'
.uni-page-head-btn
'
)
const
oldColors
=
[]
const
borderRadiusElemsStyles
=
[]
for
(
let
i
=
0
;
i
<
borderRadiusElems
.
length
;
i
++
)
{
borderRadiusElemsStyles
.
push
(
borderRadiusElems
[
i
].
style
)
let
borderRadiusElem
=
borderRadiusElems
[
i
]
oldColors
.
push
(
getComputedStyle
(
borderRadiusElem
).
backgroundColor
)
borderRadiusElemsStyles
.
push
(
borderRadiusElem
.
style
)
}
this
.
_A
=
0
UniViewJSBridge
.
on
(
'
onPageScroll
'
,
({
...
...
@@ -27,7 +31,7 @@ export default {
}
if
(
alpha
>
0.5
&&
this
.
_A
<=
0.5
)
{
iconElemsStyles
.
forEach
(
function
(
iconElemStyle
)
{
iconElemStyle
.
color
=
'
#000
'
iconElemStyle
.
color
=
textColor
})
}
else
if
(
alpha
<=
0.5
&&
this
.
_A
>
0.5
)
{
iconElemsStyles
.
forEach
(
function
(
iconElemStyle
)
{
...
...
@@ -40,8 +44,11 @@ export default {
titleElem
.
style
.
opacity
=
alpha
}
transparentElemStyle
.
backgroundColor
=
`rgba(
${
this
.
_R
}
,
${
this
.
_G
}
,
${
this
.
_B
}
,
${
alpha
}
)`
borderRadiusElemsStyles
.
forEach
(
function
(
borderRadiusElemStyle
)
{
borderRadiusElemStyle
.
backgroundColor
=
`rgba(153,153,153,
${
1
-
alpha
}
)`
borderRadiusElemsStyles
.
forEach
(
function
(
borderRadiusElemStyle
,
index
)
{
let
oldColor
=
oldColors
[
index
]
let
rgba
=
oldColor
.
match
(
/
\d
+/g
)
rgba
[
3
]
=
(
1
-
alpha
)
*
(
rgba
.
length
===
4
?
rgba
[
3
]
:
1
)
borderRadiusElemStyle
.
backgroundColor
=
`rgba(
${
rgba
}
)`
})
})
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录