QA:区块如何通过emit和父组件通信 #1455
Unanswered
chilingling
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
假设我们需要将区块的按钮点击事件向上抛出:
1. 区块声明事件

在区块设置中,添加事件:
事件名命名规则:必须以
on
开头:on
后面拼接事件名2. 为区块中的按钮绑定点击事件
在 步骤 e,里面,我们就可以使用 emit 将该按钮的点击事件,向上 emit。
比如:
然后我们就可以发布区块,提供给页面使用。
3. 在页面中接受事件
具体步骤为:
a. 添加已发布区块到区块分组(省略)
b. 将已添加区块拖拽到画布
c. 选中区块
d. 切换到高级设置面板
e. 绑定 onButtonClick 事件(上述 区块声明的事件)
f. 在 JS 面板中接收参数并进行逻辑处理
Beta Was this translation helpful? Give feedback.
All reactions