标签:style mit cal dde delegate agg clone call bsp
eventsListened.forEach(elt => { optionsAdded["on" + elt] = delegateAndEmit.call(this, elt); });
const eventsListened = ["Start", "Add", "Remove", "Update", "End"];
function delegateAndEmit(evtName) { return evtData => { if (this.realList !== null) { this["onDrag" + evtName](evtData); } emit.call(this, evtName, evtData); }; }
function emit(evtName, evtData) { this.$nextTick(() => this.$emit(evtName.toLowerCase(), evtData)); }
2.另一个方法的策略
const optionsAdded = {};
eventsToEmit.forEach(elt => { optionsAdded["on" + elt] = emit.bind(this, elt); });
const eventsToEmit = ["Choose", "Unchoose", "Sort", "Filter", "Clone"];
function emit(evtName, evtData) { this.$nextTick(() => this.$emit(evtName.toLowerCase(), evtData)); }
标签:style mit cal dde delegate agg clone call bsp
原文地址:https://www.cnblogs.com/TTblog5/p/13122025.html