Skip to content

Instantly share code, notes, and snippets.

@pawelmysior
Forked from calebporzio/SvgIcon.vue
Last active August 7, 2018 07:14
Show Gist options
  • Save pawelmysior/8c96f569853dc8ac29eeec25ff06dccc to your computer and use it in GitHub Desktop.
Save pawelmysior/8c96f569853dc8ac29eeec25ff06dccc to your computer and use it in GitHub Desktop.
SVG Icon Vue Component
<template>
<div v-html="require('!!html-loader!./../../../svg/zondicons/' + this.icon + '.svg')" v-once></div>
</template>
<script>
export default {
props: ['icon'],
mounted() {
this.$el.firstChild.classList.add(...this.$el.className.split(' '));
this.$el.firstChild.classList.add('fill-current');
this.$el.outerHTML = this.$el.innerHTML;
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment