Vue中使用自定义字体,自定义字体图标

在网络下载icon图标后,将fonts文件夹放在Vue项目src文件夹下的assets文件中,并创建一个font.css文件

在css文件中定义自定义字体,一般引用ttf文件就可以

@font-face {
    /*自定义字体名*/
    font-family: 'icomoon';
    /*路径*/
    src: url('icomoon.ttf');
    font-weight: normal;
    font-style: normal;
}

最后在main.js文件中引入font.css文件

 之后就可以正常使用了

猜你喜欢

转载自blog.csdn.net/weixin_46764819/article/details/128000574