7***@qq.com
7***@qq.com
  • 发布:2018-12-17 10:48
  • 更新:2018-12-17 11:09
  • 阅读:2655

uniapp自定义icon求帮助

分类:uni-app

按照官方demo的例子自己写的组件但就是显示不出来 应该有什么地方写错了但是没发现.....
在index.vue里面使用的 使用官方的un-icon是正常的

2018-12-17 10:48 负责人:无 分享
已邀请:
Trust

Trust - 少说废话

src:url('https://www.dxever.com/fei/delete/fonts/kficonfont.ttf') format('truetype'),

这个应该以 ; 分号结束,即:

src:url('https://www.dxever.com/fei/delete/fonts/kficonfont.ttf') format('truetype');
恋上蓝白

恋上蓝白

大概看了下,感觉没有写错,我也是自定义可以用,确认下你https://www.dxever.com/fei/delete/fonts/kficonfont.ttf下能否下载,还有各种引用有没有错误。
我贴下我的代码,你参考下

<template>  
    <view class="fa" :class="[''+type]" :style="{color:color,'font-size':fontSize}" @click="onClick()"></view>  
</template>  

<script>  
    export default {  
        props: {  
            /**  
             * 图标类型  
             */  
            type: String,  
            /**  
             * 图标颜色  
             */  
            color: String,  
            /**  
             * 图标大小  
             */  
            size: String  
        },  
        computed: {  
            fontSize() {  
                return `${this.size}px`  
            }  
        },  
        methods: {  
            onClick() {  
                this.$emit('click')  
            }  
        }  
    }  
</script>  

<style>  
    @import "../../resource/css/font-awesome.css";  
</style>  

font-awesome.css是从官方下的,放到我本地服务器上了。

  • 7***@qq.com (作者)

    刚刚看见这个回答...

    后来改一下对了,但是IOS正常显示,小程序端在安卓就不显示... 不知道你有没有这个情况

    2018-12-26 16:28

该问题目前已经被锁定, 无法添加新回复