perf: trigger event
							parent
							
								
									a50dba12aa
								
							
						
					
					
						commit
						29366a251f
					
				| 
						 | 
				
			
			@ -1,5 +1,4 @@
 | 
			
		|||
import { getOptionProps } from './props-util';
 | 
			
		||||
import { isOn } from './util';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  methods: {
 | 
			
		||||
| 
						 | 
				
			
			@ -25,13 +24,10 @@ export default {
 | 
			
		|||
      });
 | 
			
		||||
    },
 | 
			
		||||
    __emit() {
 | 
			
		||||
      // 直接调用listeners,底层组件不需要vueTool记录events
 | 
			
		||||
      // 直接调用事件,底层组件不需要vueTool记录events
 | 
			
		||||
      const args = [].slice.call(arguments, 0);
 | 
			
		||||
      let eventName = args[0];
 | 
			
		||||
      // TODO: 后续统一改成onXxxx,不在运行时转,提升性能
 | 
			
		||||
      eventName = isOn(eventName)
 | 
			
		||||
        ? eventName
 | 
			
		||||
        : `on${eventName[0].toUpperCase()}${eventName.substring(1)}`;
 | 
			
		||||
      eventName = `on${eventName[0].toUpperCase()}${eventName.substring(1)}`;
 | 
			
		||||
      const event = this.$props[eventName] || this.$attrs[eventName];
 | 
			
		||||
      if (args.length && event) {
 | 
			
		||||
        if (Array.isArray(event)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -568,7 +568,10 @@ export default {
 | 
			
		|||
      if (this.childOriginEvents[type]) {
 | 
			
		||||
        this.childOriginEvents[type](e);
 | 
			
		||||
      }
 | 
			
		||||
      this.__emit(type, e);
 | 
			
		||||
      const event = this.$props[type] || this.$attrs[type];
 | 
			
		||||
      if (event) {
 | 
			
		||||
        event(e);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    close() {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue