IE11 el-menu鼠标滑过报错:Error in v-on handler: "TypeError: 对象不支持此操作"

一、bug

IE11 el-menu鼠标滑过报错:Error in v-on handler: "TypeError: 对象不支持此操作"

二、解决

修改源码

  • 目录 node_modules\element-ui\lib\element-ui.common.js
/* 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));
  • 直接在第一行添加。
  • 参考 https://github.com/ElemeFE/element/issues/17404

你可能感兴趣的:(IE11 el-menu鼠标滑过报错:Error in v-on handler: "TypeError: 对象不支持此操作")