From a60cdc8fcfcad3d5804c99b0c2bdfaf4058561a6 Mon Sep 17 00:00:00 2001 From: hdx Date: Thu, 25 Jul 2024 14:16:16 +0800 Subject: [PATCH] =?UTF-8?q?test(=E6=8B=A6=E6=88=AA=E5=99=A8):=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0switchTab=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/interceptor/interceptor.test.js | 2 ++ pages/API/interceptor/interceptor.uvue | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pages/API/interceptor/interceptor.test.js b/pages/API/interceptor/interceptor.test.js index aa2b3aca..d32824ee 100644 --- a/pages/API/interceptor/interceptor.test.js +++ b/pages/API/interceptor/interceptor.test.js @@ -60,6 +60,7 @@ describe('interceptor', () => { it('addSwitchTabInterceptor', async () => { await page.callMethod('addSwitchTabInterceptor') await page.callMethod('switchTab') + await page.waitFor(300) const currentPage = await program.currentPage() expect(currentPage.path).toBe('pages/tabBar/API') }) @@ -69,6 +70,7 @@ describe('interceptor', () => { await currentPage1.callMethod('addSwitchTabInterceptor') await currentPage1.callMethod('removeSwitchTabInterceptor') await currentPage1.callMethod('switchTab') + await page.waitFor(300) const currentPage2 = await program.currentPage() expect(currentPage2.path).toBe('pages/tabBar/component') }) diff --git a/pages/API/interceptor/interceptor.uvue b/pages/API/interceptor/interceptor.uvue index 85dd17de..8751e64d 100644 --- a/pages/API/interceptor/interceptor.uvue +++ b/pages/API/interceptor/interceptor.uvue @@ -6,7 +6,9 @@ - + + + @@ -35,7 +37,7 @@ const switchTabInterceptor = { invoke: function (options : SwitchTabOptions) { console.log('拦截 switchTab 接口传入参数为:', options) - options.url = 'pages/tabBar/API' + options.url = '/pages/tabBar/API' }, success: function (res : SwitchTabSuccess) { console.log('拦截 switchTab 接口 success 返回参数为:', res) -- GitLab