提交 0f22e7ca 编写于 作者: H hdx

fix($off): 暂时注释掉新功能,第二个可选参数

上级 34296d5d
......@@ -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)
// })
})
......@@ -6,7 +6,7 @@
<button @click="on">开始监听</button>
<button @click="once">监听一次</button>
<button @click="off">取消监听</button>
<button @click="offAll">取消全部监听</button>
<!-- <button @click="offAll">取消全部监听</button> -->
<button @click="emit">触发监听</button>
<button @click="clear">清空消息</button>
<view class="box">
......@@ -49,7 +49,7 @@
},
offAll() {
// TODO 第二个参数为可选,后续优化后可不传递
uni.$off('test', null)
//uni.$off('test', null)
},
emit() {
uni.$emit('test', 'msg:' + Date.now())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册