本文介绍了Material-UI下拉菜单在更新为角度8后导致IE11中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开材质菜单时,带有材质8的Angular 8应用程序在IE11上引发以下错误:

Angular 8 application with material 8 throws following error on IE11 when the material menu is opened:

Unable to get property 'opacity' of undefined or null reference

在角度7.2时效果很好.二手IE11版本:11.1146.16299.0更新版本:11.0.125

It worked well with angular 7.2.Used IE11 Version: 11.1146.16299.0 Update version: 11.0.125

新的项目依赖项版本:

"dependencies": {
"@angular/animations": "^8.0.0",
"@angular/cdk": "^8.0.0",
"@angular/common": "~8.0.0",
"@angular/compiler": "~8.0.0",
"@angular/core": "~8.0.0",
"@angular/forms": "~8.0.0",
"@angular/material": "^8.0.0",
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
"classlist.js": "^1.1.20150312",
"core-js": "^3.1.3",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
"web-animations-js": "github:angular/web-animations-js#release_pr208",
"zone.js": "~0.9.1"

}

简单菜单

<mat-menu #appMenu="matMenu">
  <button mat-menu-item>Menu Item 1</button>
</mat-menu>

<button mat-button [matMenuTriggerFor]="appMenu">
  Menu
</button>

已使用的填埋物:

import 'classlist.js';  // Run `npm install --save classlist.js`.
import 'web-animations-js'; // Run `npm install --save web-animations-js`.

IE堆栈跟踪:

我使用新创建的angular 8应用程序(仅包含应用程序组件中的菜单)验证了该问题.

I verified the issue with a newly created angular 8 app containing only the menu in the app component.

有人对如何解决此问题有任何建议吗?谢谢

Does anyone have any suggestion on how to solve this issue? Thanks

推荐答案

尝试将import 'core-js/es/symbol';添加到polyfill

Try adding import 'core-js/es/symbol'; to the polyfill

这篇关于Material-UI下拉菜单在更新为角度8后导致IE11中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 06:31