Angular 7和材料在IE11中渲染不正确。
创始人
2024-10-17 02:00:31
0

在Angular 7中,要在IE11中正确渲染Angular Material组件,可以通过以下步骤解决:

  1. 确保你的Angular项目已经安装了Angular Material和Angular CDK。可以使用以下命令进行安装:
npm install @angular/material @angular/cdk
  1. 在polyfills.ts文件中添加以下polyfills来解决部分IE11的兼容性问题:
import 'core-js/es6/array';
import 'core-js/es6/date';
import 'core-js/es6/function';
import 'core-js/es6/map';
import 'core-js/es6/math';
import 'core-js/es6/object';
import 'core-js/es6/parse-float';
import 'core-js/es6/parse-int';
import 'core-js/es6/regexp';
import 'core-js/es6/set';
import 'core-js/es6/string';
import 'core-js/es6/symbol';
import 'core-js/es7/reflect';
  1. 在angular.json文件中的"scripts"数组中添加以下脚本来修复IE11的一些兼容性问题:
"scripts": [
  "node_modules/classlist.js/classList.js",
  "node_modules/core-js/client/shim.min.js",
  "node_modules/web-animations-js/web-animations.min.js",
  "node_modules/zone.js/dist/zone.js"
]
  1. 确保你的tsconfig.json文件中的"target"属性设置为"es5",因为IE11不支持ES6或更高版本的JavaScript。
"target": "es5"
  1. 如果在使用Angular Material的组件时仍然遇到问题,可以尝试在组件的CSS文件中添加以下样式:
@import '~@angular/material/prebuilt-themes/indigo-pink.css';

这将引入Angular Material的主题样式,以确保组件在IE11中正确渲染。

以上是一些解决Angular 7和Angular Material在IE11中渲染不正确的示例代码和解决方法。希望对你有所帮助!

相关内容

热门资讯

盘点几款!hhpoker德州牛... 盘点几款!hhpoker德州牛仔视频,hhpoker是正规的吗,力荐教程(有挂透明);实战中需综合运...
热点推荐!hhpoker德州真... 这是一款非常优秀的hhpoker德州真的假的 ia辅助检测软件,能够让你了解到hhpoker德州真的...
传递经验!wepoker辅助是... 传递经验!wepoker辅助是真的吗,wpk模拟器多开,力荐教程(有挂方法)1、玩家可以在wepok...
盘点一款!wepokerplu... 此外,数据分析德州(wepokerplus透视脚本免费)辅助神器app还具备辅助透视行为开挂功能,通...
最新通报!wejoker内置辅... 最新通报!wejoker内置辅助,红龙poker辅助,大神讲解(有挂软件)是由北京得wejoker内...
一分钟了解!wepoker私人... 一分钟了解!wepoker私人局外卦,wepoker安装教程,AI教程(有挂方法)这是由厦门游乐互动...
2分钟细说!佛手大菠萝有挂吗,... 2分钟细说!佛手大菠萝有挂吗,德普之星有辅助软件吗,安装教程(有挂透视)准备好在德普之星有辅助软件吗...
大家学习交流!wepoker有... 大家学习交流!wepoker有脚本吗,wepoker插件下载,2025新版教程(有挂辅助)准备好在w...
新手必备!werplan透视挂... 新手必备!werplan透视挂,wepoker透视是真的吗,wpk教程(有挂辅助);最新版2024是...
解密关于!hhpoker是真的... 解密关于!hhpoker是真的还是假的,wepoker的辅助器,实用技巧(有挂软件);hhpoker...