Skip to content

Commit 01a354e

Browse files
committed
fix: give 'size' prop precedens over height and width attributes
- add 'custom' as a valid value of 'size' prop
1 parent aba556b commit 01a354e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/CIconRaw.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
size: {
2424
type: String,
2525
validator: size => [
26-
'custom-size', 'sm', 'lg', 'xl',
26+
'custom', 'custom-size', 'sm', 'lg', 'xl',
2727
'2xl', '3xl', '4xl', '5xl', '6xl', '7xl', '8xl', '9xl'
2828
].includes(size)
2929
},
@@ -56,11 +56,12 @@ export default {
5656
return this.$attrs.viewBox || `0 0 ${this.scale}`
5757
},
5858
computedSize () {
59-
return this.$attrs.width || this.$attrs.height ? 'custom-size' : this.size
59+
const addCustom = !this.size && (this.$attrs.width || this.$attrs.height)
60+
return this.size === 'custom' || addCustom ? 'custom-size' : this.size
6061
},
6162
computedClasses () {
62-
return this.customClasses ||
63-
['c-icon', { [`c-icon-${this.computedSize}`]: this.computedSize }]
63+
const size = this.computedSize
64+
return this.customClasses || ['c-icon', { [`c-icon-${size}`]: size }]
6465
}
6566
},
6667
methods: {

0 commit comments

Comments
 (0)