uni.loadFontFace 引入外部字体没有效果,外部链接是带https的并且后台配了成合法域名也不行
小程序中使用
const fontUrl=${process.env.APP_URL}/static/11/fonts/montserrat-Black.ttf
;
//const fontUrl=/static/assets/font/montserrat-Black.ttf
console.log("字体",fontUrl)
uni.loadFontFace({
global:true,
family: 'haipai',
source: url("${fontUrl}")
,
success() {
console.log('success')
}
})
在<style>里边
@font-face {
font-family: 'haipai';
src: url('https://www5324s.s7.tunnelfrp.com/static/11/fonts/montserrat-Black.ttf');
font-weight: normal;
font-style: normal;
font-display: auto;
}
.name {
width: 100%;
height: 20px;
font-size: 16x;
color: #e1251b;
overflow: hidden;
font-family: 'haipai'
}
引入没有效果 ,外部字体大小是超过1M多的。
0 个回复