wangzhibo
4 天以前 10595d8632f959d0954d1939243196f4eed02372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<template>
    <text
        :class="['cl-icon', className || `cl-icon-${name}`, `is-${color}`]"
        :style="[
            baseStyle,
            {
                fontSize: parseRpx(size),
                color,
            },
        ]"
    ></text>
</template>
 
<script lang="ts">
import { defineComponent } from "vue";
import { useStyle } from "../../hooks";
 
export default defineComponent({
    name: "cl-icon",
    props: {
        // 图标名称
        name: String,
        // 自定义图标名称
        className: String,
        // 图标大小
        size: {
            type: [String, Number],
            default: 30,
        },
        // 图标颜色
        color: String,
    },
    setup() {
        return {
            ...useStyle(),
        };
    },
});
</script>