mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-08 19:49:24 +08:00
fix(core): 修复emit 无node时的情况
This commit is contained in:
parent
b0419cdbaf
commit
34b628cc07
@ -203,11 +203,11 @@ class App extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public emit(name: string | symbol, node: any, ...args: any[]): boolean {
|
public emit(name: string | symbol, node: any, ...args: any[]): boolean {
|
||||||
if (typeof node.data === 'undefined') {
|
if (node?.data?.id) {
|
||||||
return super.emit(name, node, ...args);
|
|
||||||
}
|
|
||||||
return super.emit(`${String(name)}_${node.data.id}`, node, ...args);
|
return super.emit(`${String(name)}_${node.data.id}`, node, ...args);
|
||||||
}
|
}
|
||||||
|
return super.emit(name, node, ...args);
|
||||||
|
}
|
||||||
|
|
||||||
public eventHandler(eventConfig: EventItemConfig, fromCpt: any, args: any[]) {
|
public eventHandler(eventConfig: EventItemConfig, fromCpt: any, args: any[]) {
|
||||||
if (!this.page) throw new Error('当前没有页面');
|
if (!this.page) throw new Error('当前没有页面');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user