【发布时间】:2019-06-05 22:08:38
【问题描述】:
我已经运行 npx create-react-app . 并手动导入了 clip-path。开发构建没有问题,但生产构建似乎不起作用。问题在 IE11 和 Edge44 上是一样的
重现步骤:
npx create-react-app .- 将“ie 11”添加到
browserslist中的package.json用于生产和开发 npm i react-app-polyfill- 在
index.js添加import 'react-app-polyfill/ie11';import 'react-app-polyfill/stable'; - 从css-shapes-polyfill 中获取
shapes-polyfill.js并在.index.html > head中插入脚本,同时添加浏览器polyfill。
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.6.15/browser-polyfill.min.js"></script>
<script src='shapes-polyfill.js'></script>
- 在
index.html > head中包含<style>
<style>
#polygon-shape-outside {
width: 200px;
height: 200px;
float: left;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200px' height='200px'><polygon points='0,0 142,33 89,141 0,200' fill='rgba(0,0,255, 0.25)'/></svg>");
shape-outside: polygon(0px 0px, 142px 33px, 89px 141px, 0px 200px);
}
</style>
- 在
App中插入 div
<div style={{
width: 400,
fontSize: 10,
background: 'grey'
}}>
<div id="polygon-shape-outside"></div>
<p>Pelicans are a genus of large water birds comprising the family Pelecanidae. They are characterised by a long beak and large throat pouch used for catching prey and draining water from the scooped up contents before swallowing. They have predominantly pale plumage, the exceptions being the Brown and Peruvian Pelicans. The bills, pouches and bare facial skin of all species become brightly coloured before the breeding season. The eight living pelican species have a patchy global distribution, ranging latitudinally from the tropics to the temperate zone, though they are absent from interior South America as well as from polar regions and the open ocean. Fossil evidence of pelicans dates back at least 30 million years, to the remains of a beak very similar to that of modern species recovered from Oligocene strata in France.</p>
</div>
【问题讨论】:
标签: reactjs internet-explorer-11 polygon microsoft-edge clip-path