Skip to content

Instantly share code, notes, and snippets.

@depsimon
Last active April 15, 2018 13:00
Show Gist options
  • Save depsimon/029c2add384a234e151f1ef759b66300 to your computer and use it in GitHub Desktop.
Save depsimon/029c2add384a234e151f1ef759b66300 to your computer and use it in GitHub Desktop.
Font Awesome 5 - SVG Icon component
<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