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