-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
怎样添加事件 #26
Comments
定义触发时机首先在注册按钮组件时,定义它的支持的事件: class Props {
public editSetting = {
key: 'my-button',
name: 'Button',
editors: [
// ..省略
],
events: [
{
text: 'OnClick',
field: 'onClick'
}
]
};
} 上面通过 下一步就是触发效果了,触发效果现在不能拓展,我最近会增加一个链接跳转的方式,这样只要组件注册了触发时机,就可以选择跳转到某个 url 了。 |
主要是触发效果不知道怎么写,不了解内部事件机制的原理,有点无从下手,好比说我怎么跳转到内部其他页面去,点按钮打开模态框等等交互,最近也在看源码,但事件那部分还没弄懂,希望大神点拨点拨 |
事件这块还在完善中,Modal 联动功能现在还不支持,具体效果完成后交互方式应该是这样:https://tb1.bdstatic.com/next-designer/event-emit.mp4 |
OK 谢谢解答 |
什么时候会更新到github上,期待ing |
@denvey 最近一两周内 |
貌似事件这块现在也没有完成,发现 event emitter 没有对外暴露,也没有提供注册内部event的方法,而且在新的page里面没有store管理的状态,我理解的Gaea editor应该基于事件流,通过上面的方法修改组件的状态,通过自定义的函数和服务器交互,然后再走 redux 那一套把数据绑到 view 上,完成整个逻辑的渲染。 前几天试了试clone 的代码,今天有看,如果有不对的地方,或者已经完成,还请指正 |
@ascoders 事件机制我看现在的代码还是没有实现视频上的功能 |
假如 有这样一个需求 我自定义一个按钮组件,然后我需要给这个按钮加个事件,比如就加个跳转,点击按钮跳转到百度,能丢一个例子出来参考下怎么写么?谢谢!
The text was updated successfully, but these errors were encountered: