【发布时间】:2018-11-27 10:30:18
【问题描述】:
使用Setup Method 2 self hosting 为我们的 React 项目安装 Google Material 图标,与图标关联的连字有时会显示在材料图标之前。
<i class="material-icons">face</i> {/* shows text "face" on site prior to proper material icon load */}
例如,上面的行会在显示人脸之前先显示“人脸”一秒钟。我们如何才能延迟 UI 渲染,直到文件引用完全加载?
/*material icons file references loaded locally */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.eot); /* For IE6-8 */
src: local('Material Icons'), local('MaterialIcons-Regular'), url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff2) format('woff2'), url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.woff) format('woff'), url(../node_modules/material-design-icons/iconfont/MaterialIcons-Regular.ttf) format('truetype');
}
【问题讨论】: