mirror of
				https://github.com/Tencent/tmagic-editor.git
				synced 2025-11-04 02:28:04 +08:00 
			
		
		
		
	
							parent
							
								
									6d91cacc84
								
							
						
					
					
						commit
						b835bb2488
					
				@ -28,6 +28,7 @@ import {
 | 
				
			|||||||
  isCommonMethod,
 | 
					  isCommonMethod,
 | 
				
			||||||
  triggerCommonMethod,
 | 
					  triggerCommonMethod,
 | 
				
			||||||
} from './events';
 | 
					} from './events';
 | 
				
			||||||
 | 
					import type Node from './Node';
 | 
				
			||||||
import Page from './Page';
 | 
					import Page from './Page';
 | 
				
			||||||
import { fillBackgroundImage, isNumber, style2Obj } from './utils';
 | 
					import { fillBackgroundImage, isNumber, style2Obj } from './utils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -207,11 +208,18 @@ class App extends EventEmitter {
 | 
				
			|||||||
      eventName = getCommonEventName(eventName, id);
 | 
					      eventName = getCommonEventName(eventName, id);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.on(eventName, (fromCpt, ...args) => {
 | 
					    this.on(`${eventName}_${id}`, (fromCpt: Node, ...args) => {
 | 
				
			||||||
      this.eventHandler(event, fromCpt, args);
 | 
					      this.eventHandler(event, fromCpt, args);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public emit(name: string | symbol, node: any, ...args: any[]): boolean {
 | 
				
			||||||
 | 
					    if (typeof node.data === 'undefined') {
 | 
				
			||||||
 | 
					      return super.emit(name, node, ...args);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return super.emit(`${String(name)}_${node.data.id}`, ...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