From 0f22e7ca6df8fb1a56c5d4bef6fb8bf5bb92e38b Mon Sep 17 00:00:00 2001 From: hdx Date: Tue, 9 Apr 2024 11:03:16 +0800 Subject: [PATCH] =?UTF-8?q?fix($off):=20=E6=9A=82=E6=97=B6=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E6=8E=89=E6=96=B0=E5=8A=9F=E8=83=BD=EF=BC=8C=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E4=B8=AA=E5=8F=AF=E9=80=89=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/event-bus/event-bus.test.js | 30 +++++++++++++-------------- pages/API/event-bus/event-bus.uvue | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pages/API/event-bus/event-bus.test.js b/pages/API/event-bus/event-bus.test.js index bf58ee9d..b0b61183 100644 --- a/pages/API/event-bus/event-bus.test.js +++ b/pages/API/event-bus/event-bus.test.js @@ -52,21 +52,21 @@ describe('event-bus', () => { expect(l3).toBe(0) }) - it('off-all', async () => { - await page.callMethod('clear') - await page.callMethod('on') - await page.callMethod('on2') - await page.callMethod('emit') - const l1 = (await page.data()).log.length - expect(l1).toBe(2) + // it('off-all', async () => { + // await page.callMethod('clear') + // await page.callMethod('on') + // await page.callMethod('on2') + // await page.callMethod('emit') + // const l1 = (await page.data()).log.length + // expect(l1).toBe(2) - await page.callMethod('clear') - const l2 = (await page.data()).log.length - expect(l2).toBe(0) + // await page.callMethod('clear') + // const l2 = (await page.data()).log.length + // expect(l2).toBe(0) - await page.callMethod('offAll') - await page.callMethod('emit') - const l3 = (await page.data()).log.length - expect(l3).toBe(0) - }) + // await page.callMethod('offAll') + // await page.callMethod('emit') + // const l3 = (await page.data()).log.length + // expect(l3).toBe(0) + // }) }) diff --git a/pages/API/event-bus/event-bus.uvue b/pages/API/event-bus/event-bus.uvue index 30c65d63..b470400e 100644 --- a/pages/API/event-bus/event-bus.uvue +++ b/pages/API/event-bus/event-bus.uvue @@ -6,7 +6,7 @@ - + @@ -49,7 +49,7 @@ }, offAll() { // TODO 第二个参数为可选,后续优化后可不传递 - uni.$off('test', null) + //uni.$off('test', null) }, emit() { uni.$emit('test', 'msg:' + Date.now()) -- GitLab