admin管理员组

文章数量:1644426

原因

今天有测试提了个bug ,是关于ie11打开react项目时,出现错位,输入框无法输入等问题,

就问了一下大佬,大佬说umi的css基本上时适用于chorme浏览器的,而chorme的css和IE的css有一点不同,所以当chorme显示正常时,ie就会出现一些问题,

如果想支持ie,就得一个一个调,umi除了logo和极少数的部分是直接适用ie的,其他包括下载的命令或者输入的input都有些区别。

然后在网上也查了一下,大致总结一下就是

1)微软官方都放弃了,新出的edge都是采用chorme内核
2)ie使用的人少,react官方不想花太多精力在ie兼容上
3)ie卡

当然这也是我自己猜测的,没有啥依据,然后就是解决办法

目前项目是不兼容的,万一以后自己要写兼容的咋办,先记录一下找到的解决方法(未尝试

解决办法

1

1. Create your basic application with npx create-react-app [AppName]
2. Add import react-app-polyfill/ie11; to the VERY top of index.js
3. If you need common standard functions like Array.find() that are not supported in IE 11 add import 'react-app-polyfill/stable'; just below the first line in index.js
4. In package.json copy the production browserlist to development so you can test in IE11
5. Delete the node_modules/.cache directory

2

npm install core-js -D

//在入口文件第一行引入
//一定要第一行
import 'core-js'

//在package.json中的development和production里加上
"ie 11"

3

npm install babel-polyfill --save
//入口文件
import "babel-polyfill"

//当用到new URL()时还需要安装url-polyfill
npm i url-polyfill --save

先记录三个吧,也不知道有没有效果,看了下大家写的方法还挺多的,所以要是这三个方法不行,再查查应该总归有work的

本博客仅限参考,请谨慎食用

如果有帮助到你,点个赞吧!!

本文标签: 不支持解决办法原因React