vue-自定义字体引用

2021-03-15  本文已影响0人  Melody_28a2
  1. 需要提供后缀为.ttf的文件,打开在线字体生成器,上传.ttf后,点击立即生成,稍等一会之后,会下载压缩包,解压后即可使用

  2. 将字体文件引入

@font-face {
  font-family: "NotoSans-SemiCondensed";
  src: url('NotoSans-SemiCondensed.ttf');
  font-weight: normal;
  font-style: normal;
}
@font-face {
  font-family: "NotoSans-SemiCondensedBold";
  src: url('NotoSans-SemiCondensedBold.ttf');
  font-weight: normal;
  font-style: normal;
}
module: {
    rules: [
        {
            test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
            loader: 'url-loader',
            options: {
                limit: 10000,
                name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
            }
        }
    ]
}
上一篇 下一篇

猜你喜欢

热点阅读