Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
b078ce77
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6068
Star
93
Fork
166
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b078ce77
编写于
3月 02, 2024
作者:
DCloud-yinjiacheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
还原状态栏背景色相关示例代码
上级
d3dc740d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
7 addition
and
129 deletion
+7
-129
components/uni-navbar-lite/uni-navbar-lite.uvue
components/uni-navbar-lite/uni-navbar-lite.uvue
+1
-1
pages.json
pages.json
+6
-19
pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation.test.js
...-color/set-navigation-bar-color-custom-navigation.test.js
+0
-49
pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation.uvue
...bar-color/set-navigation-bar-color-custom-navigation.uvue
+0
-48
pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue
...PI/set-navigation-bar-color/set-navigation-bar-color.uvue
+0
-12
未找到文件。
components/uni-navbar-lite/uni-navbar-lite.uvue
浏览文件 @
b078ce77
...
...
@@ -66,7 +66,7 @@
mounted() {
uni.setNavigationBarColor({
frontColor: "#000000",
backgroundColor: "#
007a
ff",
backgroundColor: "#
ffff
ff",
});
},
methods: {
...
...
pages.json
浏览文件 @
b078ce77
...
...
@@ -380,13 +380,6 @@
"navigationBarTitleText"
:
"设置导航条颜色"
}
},
{
"path"
:
"pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"设置状态栏颜色"
}
},
{
"path"
:
"pages/API/set-navigation-bar-title/set-navigation-bar-title"
,
"style"
:
{
...
...
@@ -1087,8 +1080,7 @@
{
"path"
:
"pages/template/swiper-vertical-video/swiper-vertical-video"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"transparent"
"navigationStyle"
:
"custom"
}
},
//
#ifdef
APP
...
...
@@ -1103,8 +1095,7 @@
"path"
:
"pages/template/scroll-fold-nav/scroll-fold-nav"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTextStyle"
:
"black"
,
"navigationBarBackgroundColor"
:
"transparent"
"navigationBarTextStyle"
:
"black"
}
},
{
...
...
@@ -1136,16 +1127,14 @@
{
"path"
:
"pages/template/pull-zoom-image/pull-zoom-image"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"transparent"
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/template/navbar-lite/navbar-lite"
,
"style"
:
{
"navigationBarTitleText"
:
"自定义导航栏"
,
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"#007aff"
"navigationStyle"
:
"custom"
}
},
{
...
...
@@ -1187,16 +1176,14 @@
"path"
:
"pages/webview-screenshot-comparison/webview-screenshot-comparison"
,
"style"
:
{
"navigationBarTitleText"
:
"截图对比测试"
,
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"transparent"
"navigationStyle"
:
"custom"
}
},
{
"path"
:
"pages/webview-screenshot/webview-screenshot"
,
"style"
:
{
"navigationBarTitleText"
:
"webview 截图测试"
,
"navigationStyle"
:
"custom"
,
"navigationBarBackgroundColor"
:
"transparent"
"navigationStyle"
:
"custom"
}
},
//
#ifdef
APP
...
...
pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation.test.js
已删除
100644 → 0
浏览文件 @
d3dc740d
const
CURRENT_PAGE_PATH
=
'
/pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation
'
describe
(
'
set statusBar color
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
it
(
'
dummyTest
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
const
adbScreenShotArea
=
{
x
:
880
,
y
:
0
,
width
:
60
,
height
:
60
};
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android 6
'
))
{
adbScreenShotArea
.
x
=
535
adbScreenShotArea
.
width
=
90
adbScreenShotArea
.
height
=
50
}
else
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android 12
'
))
{
adbScreenShotArea
.
x
=
1160
adbScreenShotArea
.
width
=
70
adbScreenShotArea
.
height
=
80
}
beforeAll
(
async
()
=>
{
page
=
await
program
.
navigateTo
(
CURRENT_PAGE_PATH
)
await
page
.
waitFor
(
1000
)
})
it
(
"
setNavigationBarColor1
"
,
async
()
=>
{
await
page
.
callMethod
(
"
setNavigationBarColor1
"
);
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
adbScreenShotArea
});
expect
(
image
).
toMatchImageSnapshot
();
});
it
(
"
setNavigationBarColor2
"
,
async
()
=>
{
await
page
.
callMethod
(
"
setNavigationBarColor2
"
);
const
image
=
await
program
.
screenshot
({
adb
:
true
,
area
:
adbScreenShotArea
});
expect
(
image
).
toMatchImageSnapshot
();
});
})
pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation.uvue
已删除
100644 → 0
浏览文件 @
d3dc740d
<template>
<page-head title="setNavigationBarColor"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<button @tap="setNavigationBarColor1" class="uni-btn">
设置状态栏背景绿色,文字白色
</button>
<button @tap="setNavigationBarColor2" class="uni-btn">
设置状态栏背景红色,文字黑色
</button>
</view>
</template>
<script>
export default {
methods: {
setNavigationBarColor1() {
uni.setNavigationBarColor({
frontColor: "#ffffff",
backgroundColor: "#00ff00",
success: () => {
console.log("setNavigationBarColor success");
},
fail: () => {
console.log("setNavigationBarColor fail");
},
complete: () => {
console.log("setNavigationBarColor complete");
},
});
},
setNavigationBarColor2() {
uni.setNavigationBarColor({
frontColor: "#000000",
backgroundColor: "#ff0000",
success: () => {
console.log("setNavigationBarColor success");
},
fail: () => {
console.log("setNavigationBarColor fail");
},
complete: () => {
console.log("setNavigationBarColor complete");
},
});
},
},
};
</script>
pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue
浏览文件 @
b078ce77
...
...
@@ -7,16 +7,9 @@
<button @tap="setNavigationBarColor2" class="uni-btn">
设置导航条背景红色,标题黑色
</button>
<!-- #ifdef WEB -->
<button @tap="goNavbarLite" class="uni-btn">
跳转自定义导航栏页面
</button>
<!-- #endif -->
<!-- #ifdef APP -->
<button @tap="goCustomNavigation" class="uni-btn">
跳转设置状态栏页面
</button>
<!-- #endif -->
</view>
</template>
...
...
@@ -73,11 +66,6 @@
uni.navigateTo({
url: '/pages/template/navbar-lite/navbar-lite'
})
},
goCustomNavigation() {
uni.navigateTo({
url: '/pages/API/set-navigation-bar-color/set-navigation-bar-color-custom-navigation'
})
}
},
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录