From 04977efd219985fc15c982df917a957c327a52d9 Mon Sep 17 00:00:00 2001 From: hdx Date: Thu, 6 Jul 2023 15:01:07 +0800 Subject: [PATCH] feat: add api pageScrollTo --- pages.json | 7 +++ pages/API/page-scrollTo/page-scrollTo.test.js | 26 ++++++++++ pages/API/page-scrollTo/page-scrollTo.uvue | 51 +++++++++++++++++++ pages/tabBar/API/API.uvue | 5 ++ 4 files changed, 89 insertions(+) create mode 100644 pages/API/page-scrollTo/page-scrollTo.test.js create mode 100644 pages/API/page-scrollTo/page-scrollTo.uvue diff --git a/pages.json b/pages.json index a6db436c..31fff2aa 100644 --- a/pages.json +++ b/pages.json @@ -563,6 +563,13 @@ } } + ,{ + "path" : "pages/API/page-scrollTo/page-scrollTo", + "style" : { + "navigationBarTitleText": "pageScrollTo", + "enablePullDownRefresh": false + } + } ], "globalStyle": { "pageOrientation": "portrait", diff --git a/pages/API/page-scrollTo/page-scrollTo.test.js b/pages/API/page-scrollTo/page-scrollTo.test.js new file mode 100644 index 00000000..c16698ee --- /dev/null +++ b/pages/API/page-scrollTo/page-scrollTo.test.js @@ -0,0 +1,26 @@ +const PAGE_PATH = '/pages/API/page-scrollTo/page-scrollTo' + +describe('page-scrollTo', () => { + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(500) + }) + // TODO + // it('scrollTo', async () => { + // const btnScrollTo = await page.$('.btn-scrollTo') + + // await toggle.tap() + // await page.waitFor(50) + // expect(await page.scrollTop).toBe(100) + // }) + // it('scrollToElement', async () => { + // const btnScrollTo = await page.$('.btn-scrollToElement') + // const scrollToElement = await page.$('.custom-element') + + // await btnScrollTo.tap() + // await page.waitFor(50) + // const offset = await scrollToElement.offset() + // expect(offset.top).toBe(0) + // }) +}) \ No newline at end of file diff --git a/pages/API/page-scrollTo/page-scrollTo.uvue b/pages/API/page-scrollTo/page-scrollTo.uvue new file mode 100644 index 00000000..3a949c93 --- /dev/null +++ b/pages/API/page-scrollTo/page-scrollTo.uvue @@ -0,0 +1,51 @@ + + + + + \ No newline at end of file diff --git a/pages/tabBar/API/API.uvue b/pages/tabBar/API/API.uvue index c01c024b..6ace807f 100644 --- a/pages/tabBar/API/API.uvue +++ b/pages/tabBar/API/API.uvue @@ -112,6 +112,11 @@ url: "toast", enable: true }, + { + name: "将页面滚动到目标位置", + url: "page-scrollTo", + enable: true + }, ] as Page[], }, { -- GitLab