feat(core): 事件支持关联数据源自身方法

This commit is contained in:
roymondchen 2025-08-15 12:25:00 +08:00
parent 77da3f9762
commit 4c6118f50f

View File

@ -288,15 +288,15 @@ class App extends EventEmitter {
if (!dataSource) return;
try {
const methods = dataSource.methods || [];
const method = methods.find((item) => item.name === methodName);
if (!method) return;
if (typeof method.content === 'function') {
try {
if (method && typeof method.content === 'function') {
await method.content({ app: this, params, dataSource, eventParams: args, flowState });
} else if (typeof dataSource[methodName] === 'function') {
await dataSource[methodName]();
}
} catch (e: any) {
if (this.errorHandler) {
this.errorHandler(e, dataSource, { type: 'data-source-method', params, eventParams: args, flowState });
@ -305,7 +305,6 @@ class App extends EventEmitter {
}
}
}
}
public destroy() {
this.removeAllListeners();