zoukankan      html  css  js  c++  java
  • 微信小程序使用特殊字体包

    js页面

    Page({
        data: {
           fontFamily: 'font1', 
        },
        loadFontFace() {
            const self = this
            wx.loadFontFace({
                family: this.data.fontFamily,  
                // 将ttf格式的字体包上传到线上服务器,
                source: 'url("https://mybucket-1258364471.cos.ap-chengdu.myqcloud.com/5440d071-b699-4d1a-b5f7-fc0203eecbef.ttf")',
                success(res) {
                    console.log(res.status)
                },
                fail(res) {
                    console.log(res.status)
                },
                complete(res) {
                    console.log(res.status)
                }
            })
        },
        onLoad: function(options) {
           this.loadFontFace()
            
        },
        onReady: function() {
            //Do some when page ready.
            
        },
        onShow: function() {
            //Do some when page show.
            
        },
        onHide: function() {
            //Do some when page hide.
            
        },
        onUnload: function() {
            //Do some when page unload.
            
        },
        onPullDownRefresh: function() {
            //Do some when page pull down.
            
        }
    })
    

    html/wxml

       <text class='name_jj font-loaded'>{{item.name}}</text>
    

    css/wxss

    .font-loaded {
      font-family: 'font1';
      font-size: 40rpx;
      text-shadow: 0 0 8rpx #9F5314, 8rpx 0 #9F5314, 0 8rpx #9F5314, -2px 0 #9F5314;
      filter: glow(color=#9F5314, strength=3);
      color: #F6EDC1;
    }
    
  • 相关阅读:
    洛谷P2886 [USACO07NOV]Cow Relays G
    CF1344F Piet's Palette
    CF1344E Train Tracks
    CF1342F Make It Ascending
    LOJ6049 拍苍蝇
    test20200430 最长路径
    LG1742 最小圆覆盖 和 LOJ6360 复燃「恋之埋火」
    LOJ6358 前夕
    LOJ6485 LJJ学二项式定理
    LOJ2882 两个人的星座
  • 原文地址:https://www.cnblogs.com/j-j-h/p/14476223.html
Copyright © 2011-2022 走看看