uniapp text 中使用 图标库

2021-09-07  本文已影响0人  偶头像超凶

由于 text 中不能使用 <slot></slot>,所有用的传值
重点 :iconFlog="'\ue6e3'"
重点 :iconFlog="'\ue6e3'"
重点 :iconFlog="'\ue6e3'"
一定要这么写 ,不要 iconFlog="\ue6e3"

1、父组件中 , 重点 :iconFlog="'\ue6e3'" ,一定要这么写

<free-icon-button :iconFlog="'\ue6e3'" @click="search()"></free-icon-button>
import freeIconButton from '@/components/free-ui/free-icon-button.vue'
export default {
    components: {
        freeIconButton
    }
}

2、子组件: free-icon-button.vue

<template>
    <view @click="$emit('click')"  style="width: 90rpx; height: 90rpx;">
        <text class="iconfont font-md"> {{iconFlog}} </text>    
    </view>
</template>
export default{
    props:{
        iconFlog:{
            type: String,
            default: ''
        }
    }
}
上一篇 下一篇

猜你喜欢

热点阅读