From 34296d5d8a161e44e4b47f324b2f4db300a8c9a3 Mon Sep 17 00:00:00 2001 From: shutao Date: Mon, 8 Apr 2024 17:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eswiper=E5=B5=8C=E5=A5=97list-?= =?UTF-8?q?view=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 8 +++ .../component/swiper/swiper-list-view.test.js | 26 +++++++ pages/component/swiper/swiper-list-view.uvue | 69 +++++++++++++++++++ pages/component/swiper/swiper.uvue | 9 ++- 4 files changed, 111 insertions(+), 1 deletion(-) create mode 100644 pages/component/swiper/swiper-list-view.test.js create mode 100644 pages/component/swiper/swiper-list-view.uvue diff --git a/pages.json b/pages.json index 3fa90a7b..fdc2f99c 100644 --- a/pages.json +++ b/pages.json @@ -1277,6 +1277,14 @@ "navigationBarTitleText" : "自定义虚拟长列表", "enablePullDownRefresh" : false } + }, + { + "path" : "pages/component/swiper/swiper-list-view", + "style" : + { + "navigationBarTitleText" : "swiper嵌套list-view", + "enablePullDownRefresh" : false + } } // #endif ], diff --git a/pages/component/swiper/swiper-list-view.test.js b/pages/component/swiper/swiper-list-view.test.js new file mode 100644 index 00000000..a8b1b998 --- /dev/null +++ b/pages/component/swiper/swiper-list-view.test.js @@ -0,0 +1,26 @@ +describe('component-swiper-list-view', () => { + let page + beforeAll(async () => { + //打开swiper-list-view测试页 + page = await program.reLaunch('/pages/component/swiper/swiper-list-view') + await page.waitFor('list-view') + }) + + it('check-sticky-header', async () => { + await page.setData({scrollTop: 300}) + await page.waitFor(600) + await page.setData({currentVal: 1}) + await page.waitFor(async () => { + return await page.data('swiperCurrentIndex') === 1; + }); + await page.waitFor(200) + await page.setData({currentVal: 0}) + await page.waitFor(async () => { + return await page.data('swiperCurrentIndex') === 0; + }); + await page.waitFor(600) + const image = await program.screenshot({fullPage: true}); + expect(image).toSaveImageSnapshot(); + }) + +}) diff --git a/pages/component/swiper/swiper-list-view.uvue b/pages/component/swiper/swiper-list-view.uvue new file mode 100644 index 00000000..8dc91715 --- /dev/null +++ b/pages/component/swiper/swiper-list-view.uvue @@ -0,0 +1,69 @@ + + + + + diff --git a/pages/component/swiper/swiper.uvue b/pages/component/swiper/swiper.uvue index 2e3200fb..6c63c954 100644 --- a/pages/component/swiper/swiper.uvue +++ b/pages/component/swiper/swiper.uvue @@ -73,7 +73,14 @@ swiperChange 是否打印 - + + + + + + -- GitLab