提交 7dfd3a9f 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor(dialogPage): 调整 eventBus 用法

上级 31ce189a
...@@ -55,13 +55,13 @@ ...@@ -55,13 +55,13 @@
// 自动化测试 // 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1) setLifeCycleNum(state.lifeCycleNum + 1)
} }
dialogPage.$emit('fn1', { from: 'dialog1' }) dialogPage.emit('fn1', { from: 'dialog1' })
dialogPage.$emit('fn2', null) dialogPage.emit('fn2', null)
dialogPage.$off('fn2', null) dialogPage.off('fn2', null)
dialogPage.$emit('fn1', { from: 'dialog1' }) dialogPage.emit('fn1', { from: 'dialog1' })
dialogPage.$emit('fn2', null) dialogPage.emit('fn2', null)
dialogPage.$emit('fnOnce', null) dialogPage.emit('fnOnce', null)
dialogPage.$emit('fnOnce', null) dialogPage.emit('fnOnce', null)
}, },
onHide() { onHide() {
...@@ -171,4 +171,4 @@ ...@@ -171,4 +171,4 @@
.mt-10 { .mt-10 {
margin-top: 10px; margin-top: 10px;
} }
</style> </style>
...@@ -72,11 +72,11 @@ ...@@ -72,11 +72,11 @@
const fnOnce = (options: any | null) => { const fnOnce = (options: any | null) => {
console.log('dialogPage1 be triggered fnOnce', options) console.log('dialogPage1 be triggered fnOnce', options)
setLifeCycleNum(state.lifeCycleNum + 1) setLifeCycleNum(state.lifeCycleNum + 1)
} }
dialogPage.$on('fn1', fn1) dialogPage.on('fn1', fn1)
dialogPage.$on('fn1', fn11) dialogPage.on('fn1', fn11)
dialogPage.$on('fn2', fn2) dialogPage.on('fn2', fn2)
dialogPage.$once('fnOnce', fnOnce) dialogPage.once('fnOnce', fnOnce)
}, },
openDialog2() { openDialog2() {
uni.openDialogPage({ uni.openDialogPage({
...@@ -193,4 +193,4 @@ ...@@ -193,4 +193,4 @@
} }
} }
} }
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册