diff --git a/pages/API/event-bus/event-bus.test.js b/pages/API/event-bus/event-bus.test.js
index 0e5d377414be46f0a68198aa8ea48992ede8b04f..bab1af88f0788258e32e7a70e792cfc1562354e1 100644
--- a/pages/API/event-bus/event-bus.test.js
+++ b/pages/API/event-bus/event-bus.test.js
@@ -86,4 +86,21 @@ describe('event-bus', () => {
expect(logs[0]).toBe('触发 test-return-id $on fn')
expect(logs[1]).toBe('触发 test-return-id $once fn')
})
+ it('test $emit no args', async () => {
+ await page.callMethod('clear')
+ expect((await page.data()).log.length).toBe(0)
+ await page.callMethod('testEmitNoArgs')
+ const logs = await page.data('log')
+ expect(logs.length).toBe(1)
+ expect(logs[0]).toBe('test-emit-no-args')
+ })
+ it('test $emit multiple args', async () => {
+ await page.callMethod('clear')
+ expect((await page.data()).log.length).toBe(0)
+ await page.callMethod('testEmitMultipleArgs')
+ const logs = await page.data('log')
+ expect(logs.length).toBe(1)
+ expect(logs[0]).toBe('arg1_2')
+ })
+
})
diff --git a/pages/API/event-bus/event-bus.uvue b/pages/API/event-bus/event-bus.uvue
index 99395dd7a3f618467ac006048dbbd8c0123031c2..d44718b6b96366d3a8f2f2331d7983e000b119cb 100644
--- a/pages/API/event-bus/event-bus.uvue
+++ b/pages/API/event-bus/event-bus.uvue
@@ -1,96 +1,112 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
- 收到的消息:
-
+
+
+
+ 收到的消息:
+
{{ item }}
-
-
-
+
+
+
接收到的 obj 参数:
- {{JSON.stringify(objArg)}}
+ {{ JSON.stringify(objArg) }}
-
+
+
+
-
+