提交 b078ce77 编写于 作者: DCloud-yinjiacheng's avatar DCloud-yinjiacheng

还原状态栏背景色相关示例代码

上级 d3dc740d
......@@ -66,7 +66,7 @@
mounted() {
uni.setNavigationBarColor({
frontColor: "#000000",
backgroundColor: "#007aff",
backgroundColor: "#ffffff",
});
},
methods: {
......
......@@ -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
......
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();
});
})
<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>
......@@ -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.
先完成此消息的编辑!
想要评论请 注册