1、字体文件的全局引用(app.vue的<style>)
<style>
@font-face {
font-family: "PingFangSC";
src: url("./assets/fonts/PingFangSC.ttf");
font-weight: normal;
font-style: normal;
}
</style>
2、字体文件在组件中的应用
3、代码
<template>
<div class="cssFont">字体</div>
</template>
<script>
export default {};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.cssFont {
font-size: 16px;
color: #363e45;
font-weight: 600;
padding: 0 60px 0 60px;
height: 46px;
line-height: 46px;
font-family: PingFangSC, PingFang SC;
}
</style>