在項目的公用模板裏css自定義字體並使用
// 文件路徑 public/index.html
// 必須要先有字體文件, 比如 *.ttf文件, UI提供或網上下載
<style>
//引入字體文件並命名
@font-face {
font-family: 'custom-font'; /*字體名稱-隨意*/
src: url('你自己的字體文件路徑.ttf') format('truetype'); /*字體源文件*/
}
// 使用方法
.custom-font {
font-family: "custom-font" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
// 使用
.classNameDemo{
font-family: "custom-font";
}