在快站的页面上,便于其他插件或者模块得知一些关键事件的发生, 依赖页面已经存在的zepto实现
- form(普通表单)
- 普通表单提交成功
- event:
form:submit-success
- callback:
(formId: number) => void
- event:
- 普通表单提交失败
- event:
form:submit-fail
- callback:
(formId: number) => void
- event:
- 普通表单提交成功
- survey(高级表单)
- 高级表单提交成功
- event:
survey:submit-success
- callback:
(surveyId: number) => void
- event:
- 高级表单提交失败
- event:
survey:submit-fail
- callback:
(surveyId: number) => void
- event:
- 高级表单提交成功
- registerEvents
// 触发事件(一般在产生事件的插件里使用)
kzEvent.registerEvents([
'form:submit-success',
'form:submit-fail'
])
- on
// 监听事件
kzEvent.on('form:submit-success', function(formId) {
console.log('formId: %s', formId)
})
- trigger
// 触发事件
kzEvent.trigger('form:submit-success', [1573027116013])