Answer the question
In order to leave comments, you need to log in
How to pass icon name to mixin?
Good afternoon.
I want to make a button mixin, which as a result will accept either text or an icon as input.
mixin button(spec)
- spec = spec || {}
- spec.__class = spec.__class || 'btn'
- spec.text = spec.text || ''
button(class=spec.__class)&attributes(attributes)
span=spec.text
+button({__class:'btn btn-primary',text:'Читать'})
+button({__class:'btn-fab',text:'i.material-icons add'})
Answer the question
In order to leave comments, you need to log in
No, everything is easier if you carefully read the documentation :
mixin button(spec)
- spec = spec || {}
- spec.__class = spec.__class || 'btn'
- spec.text = spec.text || ''
button(class=spec.__class)&attributes(attributes)
if block
block
else
span=spec.text
+button({__class:'btn btn-primary', text:'Читать'})
+button({__class:'btn-fab'})
i.material-icons add
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question