🌐 AI搜索 & 代理 主页
Skip to content

Commit d79c60e

Browse files
committed
feat: CIcon: allow for font icons
1 parent 13b0aca commit d79c60e

File tree

7 files changed

+711
-14
lines changed

7 files changed

+711
-14
lines changed

vue/CIcon.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<template>
22
<svg
3+
v-if="name || content"
34
xmlns="http://www.w3.org/2000/svg"
45
:viewBox="viewBox"
56
:class="computedClasses"
67
v-html="icon.svgContent"
78
></svg>
9+
<component
10+
v-else
11+
:is="fontIconTag"
12+
:class="computedClasses"
13+
></component>
814
</template>
915

1016
<script>
@@ -21,7 +27,11 @@ export default {
2127
type: String,
2228
validator: size => ['sm', 'lg', 'xl', 'custom-size'].includes(size)
2329
},
24-
customClasses: String
30+
customClasses: [String, Array, Object],
31+
fontIconTag: {
32+
type: String,
33+
default: 'i'
34+
}
2535
},
2636
computed: {
2737
iconName () {
@@ -52,7 +62,8 @@ export default {
5262
return this.$attrs.width || this.$attrs.height ? 'custom-size' : this.size
5363
},
5464
computedClasses () {
55-
return this.customClasses || `c-icon c-icon-${this.computedSize}`
65+
return this.customClasses ||
66+
['c-icon', { [`c-icon-${this.computedSize}`]: this.computedSize }]
5667
}
5768
},
5869
methods: {

0 commit comments

Comments
 (0)