diff --git a/pages.json b/pages.json
index a5993bb292d73be5a0bdfb3cd3b26c08f0730e4c..6254699c8ad8ae8dc68f988032837a96f049e7e0 100644
--- a/pages.json
+++ b/pages.json
@@ -269,6 +269,12 @@
"navigationBarTitleText": "页面级下拉刷新",
"enablePullDownRefresh": true
}
+ },
+ {
+ "path": "pages/API/get-element-by-id/get-element-by-id",
+ "style": {
+ "navigationBarTitleText": "获取节点"
+ }
},
{
"path": "pages/API/nodes-info/nodes-info",
diff --git a/pages/API/get-element-by-id/get-element-by-id.test.js b/pages/API/get-element-by-id/get-element-by-id.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..34cd75ede394262db4f4eca5e5921d75e472b8c2
--- /dev/null
+++ b/pages/API/get-element-by-id/get-element-by-id.test.js
@@ -0,0 +1,20 @@
+const PAGE_PATH = "/pages/API/get-element-by-id/get-element-by-id";
+let page;
+
+describe("getElementById", () => {
+ beforeAll(async () => {
+ page = await program.navigateTo(PAGE_PATH);
+ await page.waitFor(1000);
+ });
+ it("getElementByNotExistId", async () => {
+ const res = await page.callMethod("getElementByNotExistId");
+ expect(!!res).toBe(false);
+ });
+ it("changeStyle", async () => {
+ await page.callMethod("changePageHeadBackgroundColor");
+ await page.callMethod("changeTextColor");
+ await page.callMethod("changeViewStyle");
+ const image = await program.screenshot();
+ expect(image).toMatchImageSnapshot();
+ });
+});
diff --git a/pages/API/get-element-by-id/get-element-by-id.uvue b/pages/API/get-element-by-id/get-element-by-id.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..6975757b1f4ca33586de1ea15435359eac03b1c7
--- /dev/null
+++ b/pages/API/get-element-by-id/get-element-by-id.uvue
@@ -0,0 +1,51 @@
+
+
+
+
+ this is text
+ this is view
+
+
+
+
+
+
+
+
diff --git a/pages/API/get-launch-options-sync/get-launch-options-sync.uvue b/pages/API/get-launch-options-sync/get-launch-options-sync.uvue
index b4e550e6a3455bdf3e88e3e913320986dc975b77..0e1ce6975d4921c357846563a33841bfc1c17c56 100644
--- a/pages/API/get-launch-options-sync/get-launch-options-sync.uvue
+++ b/pages/API/get-launch-options-sync/get-launch-options-sync.uvue
@@ -1,13 +1,12 @@
-
-
- 应用启动路径:
- {{ launchOptionsPath }}
+
+
+
+ 应用启动路径:
+ {{ launchOptionsPath }}
+
@@ -22,7 +21,7 @@ export default {
}
},
methods: {
- getLaunchOptionsSync: function () {
+ getLaunchOptionsSync() {
const launchOptions = uni.getLaunchOptionsSync()
this.launchOptionsPath = launchOptions.path
if (launchOptions.path == this.homePagePath) {
diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue
index 48826c56e9b1214cff6fc40a36b920255386c952..e225f4c3af597e0444de7b3027b3c108e2928163 100644
--- a/pages/tabBar/API.uvue
+++ b/pages/tabBar/API.uvue
@@ -173,7 +173,12 @@
name: "节点布局交互状态",
url: "intersection-observer",
enable: false
- }, */
+ }, */
+ {
+ name: '获取节点',
+ url: 'get-element-by-id',
+ api: ["getElementById"]
+ },
{
name: '节点信息',
url: 'nodes-info',