IconFont.vue
1.31 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!--
* @Date: 2026-01-29 21:30:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2026-01-30 15:29:14
* @FilePath: /manulife-weapp/src/components/IconFont.vue
* @Description: 图标字体组件
-->
<template>
<component :is="iconComponent" v-if="iconComponent" :size="size" :class="customClass" :color="color" />
</template>
<script setup>
import { computed } from 'vue';
import {
Cart,
Category,
Check,
Checklist,
Clock,
Download,
Edit,
Find,
Home,
Issue,
Link,
Loading,
Location,
My,
Order,
People,
PlayCircleFill,
Refresh,
RectRight,
RectLeft,
Search,
Service,
Star,
StarFill,
Top,
Photograph,
Del
} from '@nutui/icons-vue-taro';
const props = defineProps({
name: {
type: String,
required: true
},
size: {
type: [String, Number],
default: ''
},
color: {
type: String,
default: ''
},
customClass: {
type: String,
default: ''
}
});
const icons = {
Cart,
Category,
Check,
Checklist,
Clock,
Download,
Edit,
Find,
Home,
Issue,
Link,
Loading,
Location,
My,
Order,
People,
PlayCircleFill,
Refresh,
RectRight,
RectLeft,
Search,
Service,
Star,
StarFill,
Top,
Photograph,
Del
};
const iconComponent = computed(() => {
return icons[props.name] || null;
});
</script>