Skip to content

Commit 29366a2

Browse files
committed
perf: trigger event
1 parent a50dba1 commit 29366a2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

components/_util/BaseMixin.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { getOptionProps } from './props-util';
2-
import { isOn } from './util';
32

43
export default {
54
methods: {
@@ -25,13 +24,10 @@ export default {
2524
});
2625
},
2726
__emit() {
28-
// 直接调用listeners,底层组件不需要vueTool记录events
27+
// 直接调用事件,底层组件不需要vueTool记录events
2928
const args = [].slice.call(arguments, 0);
3029
let eventName = args[0];
31-
// TODO: 后续统一改成onXxxx,不在运行时转,提升性能
32-
eventName = isOn(eventName)
33-
? eventName
34-
: `on${eventName[0].toUpperCase()}${eventName.substring(1)}`;
30+
eventName = `on${eventName[0].toUpperCase()}${eventName.substring(1)}`;
3531
const event = this.$props[eventName] || this.$attrs[eventName];
3632
if (args.length && event) {
3733
if (Array.isArray(event)) {

components/vc-trigger/Trigger.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,10 @@ export default {
568568
if (this.childOriginEvents[type]) {
569569
this.childOriginEvents[type](e);
570570
}
571-
this.__emit(type, e);
571+
const event = this.$props[type] || this.$attrs[type];
572+
if (event) {
573+
event(e);
574+
}
572575
},
573576

574577
close() {

0 commit comments

Comments
 (0)