From e9385585926fce908e4dca261951359c21d2d70a Mon Sep 17 00:00:00 2001
From: zhenyuWang <13641039885@163.com>
Date: Wed, 1 Nov 2023 16:16:32 +0800
Subject: [PATCH] feat: setNavigationBarTitle
---
pages.json | 18 ++++---
.../set-navigation-bar-title.test.js | 26 ++++++++++
.../set-navigation-bar-title.uvue | 49 +++++++++++++++++++
pages/tabBar/API.uvue | 5 +-
4 files changed, 89 insertions(+), 9 deletions(-)
create mode 100644 pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js
create mode 100644 pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue
diff --git a/pages.json b/pages.json
index 26865d40..09868bb2 100644
--- a/pages.json
+++ b/pages.json
@@ -257,11 +257,17 @@
"navigationBarTitleText": "页面跳转"
}
},
- {
- "path": "pages/API/set-navigation-bar-color/set-navigation-bar-color",
- "style": {
- "navigationBarTitleText": "设置导航条颜色"
- }
+ {
+ "path": "pages/API/set-navigation-bar-color/set-navigation-bar-color",
+ "style": {
+ "navigationBarTitleText": "设置导航条颜色"
+ }
+ },
+ {
+ "path": "pages/API/set-navigation-bar-title/set-navigation-bar-title",
+ "style": {
+ "navigationBarTitleText": "设置导航条标题"
+ }
},
{
"path": "pages/API/set-navigation-bar-color/set-custom-navigation-bar-color",
@@ -1018,7 +1024,7 @@
},
{
"path" : "pages/API/install-apk/install-apk",
- "style" :
+ "style" :
{
"navigationBarTitleText" : "install-apk",
"enablePullDownRefresh" : false
diff --git a/pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js b/pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js
new file mode 100644
index 00000000..d16c75a2
--- /dev/null
+++ b/pages/API/set-navigation-bar-title/set-navigation-bar-title.test.js
@@ -0,0 +1,26 @@
+const CURRENT_PAGE_PATH =
+ "/pages/API/set-navigation-bar-title/set-navigation-bar-title";
+
+describe("setNavigationBarColor", () => {
+ let page;
+ let originLifeCycleNum;
+ 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);
+ const lifeCycleNum = await page.callMethod("getLifeCycleNum");
+ expect(lifeCycleNum).toBe(originLifeCycleNum);
+ });
+
+ it("setNavigationBarTitle", async () => {
+ await page.callMethod("setNavigationBarTitle");
+ const image = await program.screenshot();
+ expect(image).toMatchImageSnapshot();
+ const lifeCycleNum = await page.callMethod("getLifeCycleNum");
+ expect(lifeCycleNum - originLifeCycleNum).toBe(2);
+ });
+});
diff --git a/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue b/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue
new file mode 100644
index 00000000..5f917f31
--- /dev/null
+++ b/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue
index 839df655..03fa02c7 100644
--- a/pages/tabBar/API.uvue
+++ b/pages/tabBar/API.uvue
@@ -97,12 +97,11 @@
url: 'navigator',
api: ["navigateTo", "reLaunch", "navigateBack", "redirectTo", "switchTab"]
},
- /*
+
{
name: '设置导航条标题',
url: 'set-navigation-bar-title',
- enable: false,
- }, */
+ },
{
name: '设置导航条颜色',
url: 'set-navigation-bar-color',
--
GitLab