Closed XinChou16 closed 1 year ago
Our project use element-ui, and it hack eventlistener, while overlay.vue js code bind event listener whithou check this
this
var hackEventListener = () => { Element.prototype._addEventListener = Element.prototype.addEventListener; Element.prototype._removeEventListener = Element.prototype.removeEventListener; Element.prototype.addEventListener = function(type, listener, useCapture = false) { this._addEventListener(type, listener, useCapture); if (!this.__eventListenerList__) { this.__eventListenerList__ = {}; } if (!this.__eventListenerList__[type]) { this.__eventListenerList__[type] = []; } this.__eventListenerList__[type].push({ type, listener, useCapture }); }; Element.prototype.removeEventListener = function(type, listener, useCapture = false) { this._removeEventListener(type, listener, useCapture); //... }
toggleEventListener() { const listener = this.enabled ? document.body.addEventListener : document.body.removeEventListener listener?.('mousemove', this.updateLinkParams) listener?.('click', this.handleClick, true) },
Our project use element-ui, and it hack eventlistener, while overlay.vue js code bind event listener whithou check
this
element-ui
overlay.vue