【发布时间】:2021-03-06 03:47:37
【问题描述】:
我有一个要为其设置字体的模板组件。 我现在拥有的:
index.html
<body>
<sidebar-component webpagename="dashboard"></sidebar-component>
</body>
<style>
* {
margin: 0;
font-family: Lab_Grotesque_Light;
}
@font-face {
font-family: 'Lab_Grotesque_Medium';
src: url('./assets/fonts/Lab_Grotesque_Medium.otf');
font-weight: normal;
font-style: normal;
}
</style>
这会在我在本地启动组件时设置字体。 但我想在 Vue 应用程序中使用该组件(从 npm 导入)。那里的自定义字体不起作用。有没有另一种方法来实现这一点。
【问题讨论】:
-
所以你的问题是 web 组件在这个设置中有正确的字体,但当你在 vue 应用程序中使用字体时却没有?
-
好吧,当我在 localhost 中运行 stenciljs 组件时,它就可以工作了。但是然后,我将它上传到 NPM 并在 VUE 项目中使用它,字体将无法工作@ChristianMeyer
标签: vue.js fonts stenciljs stencil-component