1 下载一个喜欢的字体 tff
http://www.font5.com.cn/tag.php?tag=ttf%B8%F1%CA%BD
2 使用 webfont 在线生成
https://www.fontke.com/tool/fontface/
3 项目创建 font.CSS
- @font-face{
- font-family:'haha'; /* 瞎取个名字 */
- src: url('char.eot'); /* IE9 */
- src: url('char.eot') format("embedded-opentype"), /* IE6-IE8 */
- url('char.woff2') format("woff"), /* Chrome,Firefox */
- url('char.ttf') format("truetype"); /* Chrome,Firefox,opera,Safari, Android, iOS 4.2+ */
- font-style: normal; font-weight: normal;
- }
4 vue 使用
4.1 引入
import FontStyles from '../font/font.css'
4.2 写样式 font-family
<h2 style="font-family: haha;">super junior example</h2>
来源: http://www.bubuko.com/infodetail-2908378.html