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;
    }
    
  • 相关阅读:
    安装ThinkPHP
    PHP数据如何向上取整
    Bootstrap 网格系统
    一篇文章让你详细了解何为JSON
    swan.onPageNotFound
    php长连接和短连接的使用场景
    写php用什么编辑器
    php随机数原理
    php接受post传值的方法
    做网站用php还是python
  • 原文地址:https://www.cnblogs.com/j-j-h/p/14476223.html
Copyright © 2011-2022 走看看