触发事件报错
现象
在节点上绑定了事件,点击节点报错,错误信息
<div data-feidao-actions="click:a001" data-v=''></div>
错误信息
Uncaught (in promise) TypeError: fun is not a function
at fire (ai.js:20)
at emit (get-emit.js:19)
at HTMLDivElement.on_1.default (init-component-events.js:34)
at HTMLDivElement.callback (on.js:90)
解决办法
将此事件对应的响应a001
引入b.ts
文件中
import a001 from './a001';
const actions = { a001 };
解决办法
查看绑定事件节点的自定义属性data-feidao-actions
,属性值格式为@event@:@action@,@event@:@action@
即事件名:响应名,事件名:响应名
,不能出现多余的其他字符,例如click:a001;
这是错误