IE11 el-menu鼠標滑過報錯:Error in v-on handler: "TypeError: 對象不支持此操作"


考慮到element-ui版本更新或者重新通過npm install安裝包時,寫入node_modules\element-ui\lib\element-ui.common.js里面的patch會失效。

其實可以單獨寫入一個文件到項目目錄里面,然后在webpack的打包入口文件里面,在引入element-ui之前引入。

 
         
 1 `(function (window) {
 2 try {
 3 new MouseEvent('test');
 4 return false; // No need to polyfill
 5 } catch (e) {
 6 // Need to polyfill - fall through
 7 }
 8 
 9 // Polyfills DOM4 MouseEvent
10 var MouseEventPolyfill = function (eventType, params) {
11     params = params || { bubbles: false, cancelable: false };
12     var mouseEvent = document.createEvent('MouseEvent');
13     mouseEvent.initMouseEvent(eventType, 
14         params.bubbles,
15         params.cancelable,
16         window,
17         0,
18         params.screenX || 0,
19         params.screenY || 0,
20         params.clientX || 0,
21         params.clientY || 0,
22         params.ctrlKey || false,
23         params.altKey || false,
24         params.shiftKey || false,
25         params.metaKey || false,
26         params.button || 0,
27         params.relatedTarget || null
28     );
29 
30     return mouseEvent;
31 }
32 
33 MouseEventPolyfill.prototype = Event.prototype;
34 
35 window.MouseEvent = MouseEventPolyfill;
36 })(window);`
 
         

 

 
        


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM