1.vue配置
App.vue中:
<style>
/*每个页面公共css */
/* 全局字体风格 */
@font-face {
font-family: 'gufengFont';
src: url('./static/font/gufeng.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
</style>
页面中:
.text1 {
font-family: 'gufengFont', sans-serif;
}
2.nvue配置
App.vue中:
<script>
export default {
onLaunch: function() {
// const domModule = weex.requireModule('dom')
const domModule = uni.requireNativePlugin('dom')
domModule.addRule('fontFace', {
'fontFamily': "gufengFont",
'src': "url('/static/font/gufeng.ttf')"
});
}
}
</script>
页面中:
.text1 {
font-family: gufengFont;
}