diff --git a/pages.json b/pages.json index 9dc1f8da25656760e9fb72d4c2516fcdf24bb505..5735e39581a94d1564f31e9b2a41104289361bc8 100644 --- a/pages.json +++ b/pages.json @@ -171,6 +171,13 @@ "navigationBarTitleText": "页面跳转" } }, + { + "path": "pages/API/set-navigation-bar-color/set-navigation-bar-color", + "style": { + "navigationBarTitleText": "设置导航条颜色" + } + }, + { "path": "pages/API/navigator/new-page/new-page-1", "style": { @@ -671,23 +678,20 @@ "navigationBarTitleText": "电量" } }, - { - "path" : "pages/CSS/border/complex-border/complex-border", - "style" : - { - "navigationBarTitleText": "border属性组合示例", - "enablePullDownRefresh": false - } + { + "path": "pages/CSS/border/complex-border/complex-border", + "style": { + "navigationBarTitleText": "border属性组合示例", + "enablePullDownRefresh": false } - ,{ - "path" : "pages/template/scroll-fold-nav2/scroll-fold-nav2", - "style" : - { + }, + { + "path": "pages/template/scroll-fold-nav2/scroll-fold-nav2", + "style": { "navigationStyle": "custom" - } - - } - ], + } + } + ], "globalStyle": { "pageOrientation": "portrait", "navigationBarTitleText": "Hello uniapp x", diff --git a/pages/API/navigator/new-page/new-page-2.uvue b/pages/API/navigator/new-page/new-page-2.uvue index 24e84e0487595806560e8cb715a9350485f1094a..dca4fb6e84eea57de3521ed35d7b587119aa3a0d 100644 --- a/pages/API/navigator/new-page/new-page-2.uvue +++ b/pages/API/navigator/new-page/new-page-2.uvue @@ -72,10 +72,7 @@ export default { }, pageScrollTo(){ uni.pageScrollTo({ - scrollTop: 1200, - complete(res){ - console.warn('pageScrollTo', res) - } + scrollTop: 1200 }) } }, diff --git a/pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js b/pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js new file mode 100644 index 0000000000000000000000000000000000000000..aeb3a668d28cb8b73a444b8c259c75ebd0a72291 --- /dev/null +++ b/pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js @@ -0,0 +1,30 @@ +const CURRENT_PAGE_PATH = + '/pages/API/set-navigation-bar-color/set-navigation-bar-color' + +describe('setNavigationBarColor', () => { + let page + let originLifeCycleNum + let lifeCycleNum + beforeAll(async () => { + page = await program.navigateTo(CURRENT_PAGE_PATH) + await page.waitFor(1000) + originLifeCycleNum = await page.callMethod('getLifeCycleNum') + }) + + afterAll(async () => { + await page.callMethod('setLifeCycleNum', originLifeCycleNum) + lifeCycleNum = await page.callMethod('getLifeCycleNum') + expect(lifeCycleNum).toBe(originLifeCycleNum) + }) + + it('setNavigationBarColor1', async () => { + await page.callMethod('setNavigationBarColor1') + const image = await program.screenshot() + expect(image).toMatchImageSnapshot() + }) + it('setNavigationBarColor2', async () => { + await page.callMethod('setNavigationBarColor2') + const image = await program.screenshot() + expect(image).toMatchImageSnapshot() + }) +}) diff --git a/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue b/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue new file mode 100644 index 0000000000000000000000000000000000000000..f80d957fe7b2f119e13dc9a8dc3b116b234974cd --- /dev/null +++ b/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue @@ -0,0 +1,74 @@ + + + + + diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue index 297d3b90f516cd7c5bd9804817617c9d410e3f8b..59960792ff1a3587106618f73417ec98a7a66a8a 100644 --- a/pages/tabBar/API.uvue +++ b/pages/tabBar/API.uvue @@ -81,10 +81,14 @@ enable: false }, { - name: "设置导航条", + name: "设置导航条标题", url: "set-navigation-bar-title", enable: false - }, + }, + { + name: "设置导航条颜色", + url: "set-navigation-bar-color", + }, { name: "设置TabBar", url: "set-tabbar",