zoukankan      html  css  js  c++  java
  • weex 学习: 添加图标(使用阿里吧吧-icon)

    添加图标(使用阿里吧吧-icon)

    <text slot="left" class="header-left">&#xe607;</text>
     
    import utils from '../../../utils/utils'
     
    export default {
        toParams(obj) {
            var param = ""
            for (const name in obj) {
                if (typeof obj[name] != 'function') {
                    param += "&" + name + "=" + encodeURI(obj[name])
                }
            }
            return param.substring(1)
        },
        initIcon() {
            const dom = weex.requireModule('dom')
            let platform = weex.config.env.platform.toLowerCase()
            let url
            if (platform == 'android') {
                url = "url('local:///iconfont.ttf')"
            } else if (platform == 'ios') {
                url = "url('local:///iconfont.ttf')"
            } else {
                url = "url('http://at.alicdn.com/t/font_934596_a7f58hu92e.ttf?v=" + new Date().getTime() + "')"
            }
            dom.addRule('fontFace', {
                'fontFamily': "iconfont",
                'src': url
            })
        },
        isPhone(phone) {
            var myreg = /^[1][3,4,5,7,8][0-9]{9}$/
            if (!myreg.test(phone)) {
                return false
            } else {
                return true
            }
        }
    }

    created() {
          utils.initIcon()
    },
    .warp-icon {
            font-family: iconfont;
            color: #2FD0AE;
            font-size: 24px;
            height: 36px;
            line-height: 36px;
            width: 46px;
            padding-right:30px;
        }

     本地文件替换

     

     
     
     
     
     
     
     
     
     
     
     
     
     
     
  • 相关阅读:
    springmvc的注解式开发
    springmvc
    spring整合Mybatis
    spring的事务管理
    注解定义增强的两个方法
    动态代理
    错题解析
    SpringMVC的基本操作
    Spring整合MyBatis
    配置事务以及事务回滚
  • 原文地址:https://www.cnblogs.com/wuss/p/10097034.html
Copyright © 2011-2022 走看看