IE reports Error in v-on handler: "TypeError: The object does not support this operation

Clicking on the el-menu in IE11 reports Error in v-on handler: "TypeError: The object does not support this operation

insert image description here

solution

Create a new js file and import it in main.js. Note that this js import needs to be introduced before elementui.
js file content into the following

/* eslint-disable */
(function(window) {
    try {
        new MouseEvent('test');
        return false; // No need to polyfill
    } catch (e) {
        // Need to polyfill - fall through
    }
    // Polyfills DOM4 MouseEvent
    var MouseEvent = function(eventType, params) {
        params = params || { bubbles: false, cancelable: false };
        var mouseEvent = document.createEvent('MouseEvent');
        mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
        return mouseEvent;
    };

    MouseEvent.prototype = Event.prototype;

    window.MouseEvent = MouseEvent;
}(window));

Original reference: https://github.com/ElemeFE/element/issues/17404

Guess you like

Origin blog.csdn.net/qq_41839808/article/details/116199500