Skip to content

Commit afbaa11

Browse files
committed
feat: QIcon - add Icon Moon support + "size" prop
1 parent ad1ce69 commit afbaa11

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/components/icon/QIcon.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export default {
55
name: String,
66
mat: String,
77
ios: String,
8-
color: String
8+
color: String,
9+
size: String
910
},
1011
render (h, ctx) {
1112
let name, text
@@ -24,7 +25,7 @@ export default {
2425
else if (icon.startsWith('fa-')) {
2526
name = `fa ${icon}`
2627
}
27-
else if (icon.startsWith('ion-')) {
28+
else if (icon.startsWith('ion-') || icon.startsWith('icon-')) {
2829
name = `${icon}`
2930
}
3031
else {
@@ -33,10 +34,19 @@ export default {
3334
}
3435

3536
data.staticClass = `${cls ? cls + ' ' : ''}q-icon${name.length ? ` ${name}` : ''}${prop.color ? ` text-${prop.color}` : ''}`
37+
3638
if (!data.hasOwnProperty('attrs')) {
3739
data.attrs = {}
3840
}
3941
data.attrs['aria-hidden'] = 'true'
42+
43+
if (prop.size) {
44+
const style = `font-size: ${prop.size};`
45+
data.style = data.style
46+
? [data.style, style]
47+
: style
48+
}
49+
4050
return h('i', data, text ? [text, ctx.children] : [' ', ctx.children])
4151
}
4252
}

0 commit comments

Comments
 (0)