mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
parent
8dcff6b731
commit
436fb3f5aa
@ -285,11 +285,11 @@ class App extends EventEmitter implements AppCore {
|
||||
* @param eventConfig 代码动作的配置
|
||||
* @returns void
|
||||
*/
|
||||
public async codeActionHandler(eventConfig: CodeItemConfig) {
|
||||
public async codeActionHandler(eventConfig: CodeItemConfig, args: any[]) {
|
||||
const { codeId = '', params = {} } = eventConfig;
|
||||
if (!codeId || isEmpty(this.codeDsl)) return;
|
||||
if (this.codeDsl![codeId] && typeof this.codeDsl![codeId]?.content === 'function') {
|
||||
await this.codeDsl![codeId].content({ app: this, params });
|
||||
await this.codeDsl![codeId].content({ app: this, params, eventParams: args });
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ class App extends EventEmitter implements AppCore {
|
||||
}
|
||||
}
|
||||
|
||||
public async dataSourceActionHandler(eventConfig: DataSourceItemConfig) {
|
||||
public async dataSourceActionHandler(eventConfig: DataSourceItemConfig, args: any[]) {
|
||||
const { dataSourceMethod = [], params = {} } = eventConfig;
|
||||
|
||||
const [id, methodName] = dataSourceMethod;
|
||||
@ -340,7 +340,7 @@ class App extends EventEmitter implements AppCore {
|
||||
if (!method) return;
|
||||
|
||||
if (typeof method.content === 'function') {
|
||||
await method.content({ app: this, params, dataSource });
|
||||
await method.content({ app: this, params, dataSource, eventParams: args });
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,9 +369,9 @@ class App extends EventEmitter implements AppCore {
|
||||
await this.compActionHandler(actionItem as CompItemConfig, fromCpt, args);
|
||||
} else if (actionItem.actionType === ActionType.CODE) {
|
||||
// 执行代码块
|
||||
await this.codeActionHandler(actionItem as CodeItemConfig);
|
||||
await this.codeActionHandler(actionItem as CodeItemConfig, args);
|
||||
} else if (actionItem.actionType === ActionType.DATA_SOURCE) {
|
||||
await this.dataSourceActionHandler(actionItem as DataSourceItemConfig);
|
||||
await this.dataSourceActionHandler(actionItem as DataSourceItemConfig, args);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user