Last active
April 15, 2018 13:00
-
-
Save depsimon/029c2add384a234e151f1ef759b66300 to your computer and use it in GitHub Desktop.
Font Awesome 5 - SVG Icon component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<svg class="icon" viewBox="0 0 512 512"><use :xlink:href="'/svg/fa-' + w + '.svg#' + n"></use></svg> | |
</template> | |
<script> | |
export default { | |
props: { | |
weight: { default: 'regular' }, | |
name: { type: String } | |
}, | |
data () { | |
return { | |
w: this.weight, | |
n: this.name | |
} | |
}, | |
mounted () { | |
if (this.$slots.default) { | |
var meta = this.$slots.default[0].text.split('/') | |
if (meta.length == 1) { | |
this.n = meta[0] | |
} else { | |
this.w = meta[0] | |
this.n = meta[1] | |
} | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment