下拉菜单在更新到

下拉菜单在更新到

本文介绍了Material-UI 下拉菜单在更新到 angular 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

它适用于 angular 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>

已经使用过的pollyfills:

Already used pollyfills:

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 下拉菜单在更新到 angular 8 后导致 IE11 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:25