【发布时间】:2020-03-07 12:56:30
【问题描述】:
基于下面的代码 sn-p (and found here),材质库根据 mwc-icon 的文本内容对组件进行样式设置。在查看找到here 的mwc-icon 的源代码后,似乎没有任何javascript 逻辑直接进行样式设置。不知何故,这似乎发生在 css 或字体定义本身中。
图标是如何应用/呈现来代替文本的?
<link href="https://fonts.googleapis.com/css?family=Material+Icons&display=block" rel="stylesheet">
<mwc-icon>shopping_cart</mwc-icon>
<script type="module">
import '@material/mwc-icon';
</script>
【问题讨论】:
标签: material-design native-web-component