Closed davestewart closed 4 years ago
If you don't want to do the camel-casing, it turns out it's pretty simple to optimize the declarations with an interim functional component:
Vue.component('icon', {
functional: true,
props: {
name: {
type: String,
required: true,
},
size: {
type: [Number, String],
default: 12,
},
fill: {
type: String,
default: '#8795a1'
}
},
render (h, context) {
const { name, size, fill } = context.props
const props = {
name: name.replace(/([a-z])([A-Z])/g, (match, a, b) => a + '-' + b.toLowerCase()),
width: size,
height: size,
fill: fill,
}
return h('unicon', { props })
}
})
Duplicate #20
Export is not reserved. @antonreshetov
Hey,
Looks like a great lib! Just about to switch to Unicons and up this pops.
I don't see the point of the
uni
prefix. I suspect most people will move their setup to a plugin file (you have to in Nuxt by default) so this just seems like extra code.Additionally, if both the imports and the names were camelCase, it would make it much easier to copy / paste icon names as they are needed:
Looking forward to using.
:D