Commit e8a2fc8f authored by Anton's avatar Anton

Add generic StyleTag component

parent ea06c9bf
<template lang="pug">
span
</template>
<script>
export default {
props: {
styles: Array
},
data () {
return {
style: undefined
}
},
created () {
const styles = this.styles || this.$slots.default
if (Array.isArray(styles)) {
this.style = styles.reduce((style, val) => style + (val.text || val), '')
}
},
mounted: function () {
const style = document.createElement('style')
style.append(document.createTextNode(this.style))
this.$el.replaceWith(style)
}
}
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment