mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-19 21:06:06 +08:00
feat(core): 事件支持关联数据源自身方法
This commit is contained in:
parent
77da3f9762
commit
4c6118f50f
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user