Commit 8805558e authored by Anton's avatar Anton

Link external stylesheets with proper html tag

parent e8a2fc8f
......@@ -5,7 +5,8 @@
<script>
export default {
props: {
styles: Array
styles: Array,
url: String
},
data () {
return {
......@@ -19,8 +20,18 @@
}
},
mounted: function () {
const style = document.createElement('style')
style.append(document.createTextNode(this.style))
let style
if (this.url) {
style = document.createElement('link')
style.setAttribute('rel', 'stylesheet')
style.setAttribute('type', 'text/css')
style.setAttribute('href', this.url)
}
else {
style = document.createElement('style')
style.setAttribute('type', 'text/css')
style.append(document.createTextNode(this.style))
}
this.$el.replaceWith(style)
}
}
......
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